このリソースに対するPOSTリクエストにはジョブ・テンプレートのサーベイの完全な仕様を含める必要がある
get
/api/v2/job_templates/{id}/survey_spec/
サーベイ仕様の例を次に示します。
{
"name": "Simple Survey",
"description": "Description of the simple survey",
"spec": [
{
"type": "text",
"question_name": "example question",
"question_description": "What is your favorite color?",
"variable": "favorite_color",
"required": false,
"default": "blue"
}
]
}
name
およびdescription
は、サーベイ仕様の冒頭の必須要素です。spec
はサーベイ項目のリストである必要があります。
各サーベイ項目内で、type
は次のいずれかである必要があります。
- text: テキスト形式の回答を想定するサーベイ質問の場合
- password: パスワードやその他の機密情報を想定するサーベイ質問の場合
- integer: 整数の回答を想定するサーベイ質問の場合
- float: 小数を想定するサーベイ質問の場合
- multiplechoice: リスト内の1つのオプションが要求されるサーベイ質問の場合
- multiselect: 提示されたリスト内の複数の項目を選択できるサーベイ質問の場合
各項目には、サーベイ質問自体について説明するquestion_name
およびquestion_description
フィールドが含まれている必要があります。 各サーベイ項目のvariable
要素は、ジョブ・テンプレートの起動時にプレイブックに渡されるキーを表します。 これには、サーベイの結果としての値が含められます。
様々な質問タイプと許容されるパラメータを示す、より包括的な例を次に示します。
{
"name": "Simple",
"description": "Description",
"spec": [
{
"type": "text",
"question_name": "cantbeshort",
"question_description": "What is a long answer",
"variable": "long_answer",
"choices": "",
"min": 5,
"max": "",
"required": false,
"default": "Leeloo Minai Lekarariba-Laminai-Tchai Ekbat De Sebat"
},
{
"type": "text",
"question_name": "cantbelong",
"question_description": "What is a short answer",
"variable": "short_answer",
"choices": "",
"min": "",
"max": 7,
"required": false,
"default": "leeloo"
},
{
"type": "text",
"question_name": "reqd",
"question_description": "I should be required",
"variable": "reqd_answer",
"choices": "",
"min": "",
"max": "",
"required": true,
"default": "NOT OPTIONAL"
},
{
"type": "multiplechoice",
"question_name": "achoice",
"question_description": "Need one of these",
"variable": "single_choice",
"choices": ["one", "two"],
"min": "",
"max": "",
"required": false,
"default": "one"
},
{
"type": "multiselect",
"question_name": "mchoice",
"question_description": "Can have multiples of these",
"variable": "multi_choice",
"choices": ["one", "two", "three"],
"min": "",
"max": "",
"required": false,
"default": "one\nthree"
},
{
"type": "integer",
"question_name": "integerchoice",
"question_description": "I need an int here",
"variable": "int_answer",
"choices": "",
"min": 1,
"max": 5,
"required": false,
"default": ""
},
{
"type": "float",
"question_name": "float",
"question_description": "I need a float here",
"variable": "float_answer",
"choices": "",
"min": 2,
"max": 5,
"required": false,
"default": ""
}
]
}
リクエスト
サポートされているメディア・タイプ
- application/json
パス・パラメータ
問合せパラメータ
- page(オプション): 整数
ページ区切りが設定された結果セット内のページ番号。
- page_size(オプション): 整数
ページごとに返す結果の数。
- search(オプション): 文字列
検索条件。
レスポンス
サポートされているメディア・タイプ
- application/json
200レスポンス
レスポンスの例(application/json)
{
}