機械翻訳について

このリソースに対するPOSTリクエストにはワークフロー・ジョブ・テンプレートのサーベイの完全な仕様を含める必要がある

post

/api/v2/workflow_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": ""
        }
    ]
}

リクエスト

サポートされているメディア・タイプ
パス・パラメータ
本文()
ルート・スキーマ : schema
例:
{
    "description":"A survey that asks about n.",
    "name":"n survey",
    "spec":[
        {
            "choices":"",
            "default":0,
            "index":0,
            "max":100,
            "min":-100,
            "question_description":"A question about new_question.",
            "question_name":"Enter a value for new_question.",
            "required":true,
            "type":"integer",
            "variable":"new_question"
        }
    ]
}
先頭に戻る

レスポンス

サポートされているメディア・タイプ

201レスポンス

403レスポンス

本文
レスポンスの例(application/json)
{
    "detail":"You do not have permission to perform this action."
}
先頭に戻る