[comment]: # ({3c277f74-3c277f74})
# httptest.create

[comment]: # ({/3c277f74-3c277f74})

[comment]: # ({9408d3d8-c4bddb28})
### 説明

`object httptest.create(object/array webScenarios)`

このメソッドでは、新しいWebシナリオを作成できます。

::: noteclassic
Webシナリオを作成すると、一連の[Web監視アイテム](/manual/web_monitoring/items)が自動的に作成されます。
:::

::: noteclassic
このメソッドは、*Admin* および *Super admin* ユーザータイプでのみ使用できます。メソッドを呼び出す権限は、ユーザーロールの設定で取り消すことができます。詳細は [ユーザーロール](/manual/web_interface/frontend_sections/users/user_roles) を参照してください。
:::

[comment]: # ({/9408d3d8-c4bddb28})

[comment]: # ({1f4a424e-5bd5a38b})
### パラメータ

`(object/array)` 作成するWebシナリオ。

このメソッドは、[標準のWebシナリオ
プロパティ](object#web-scenario)に加えて、以下の
パラメータを受け付けます。

|パラメータ|[Type](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|steps|array|[シナリオステップ](/manual/api/reference/httptest/object#scenario-step)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *必須*|
|tags|array|[Webシナリオタグ](/manual/api/reference/httptest/object#web-scenario-tag)。|

[comment]: # ({/1f4a424e-5bd5a38b})

[comment]: # ({0f4da548-0f4da548})
### 戻り値

`(object)` `httptestids`プロパティの下で作成されたWebシナリオのIDを含むオブジェクトを返します。 返されるIDの順序は、渡されたWebシナリオの順序と一致します。

[comment]: # ({/0f4da548-0f4da548})

[comment]: # ({b41637d2-b41637d2})
### 例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({5125d2fe-0b10bb11})
#### Webシナリオの作成

会社のホームページを監視するためのWebシナリオを作成します。このシナリオ
には2つのステップがあり、ホームページと「About」ページを確認して、
HTTPステータスコード 200 が返されることを確認します。

[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "httptest.create",
    "params": {
        "name": "Homepage check",
        "hostid": "10085",
        "steps": [
            {
                "name": "Homepage",
                "url": "http://example.com",
                "status_codes": "200",
                "no": 1
            },
            {
                "name": "Homepage / About",
                "url": "http://example.com/about",
                "status_codes": "200",
                "no": 2
            }
        ]
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "httptestids": [
            "5"
        ]
    },
    "id": 1
}
```

[comment]: # ({/5125d2fe-0b10bb11})

[comment]: # ({a776cebb-e8ca015f})
### 関連項目

-   [シナリオステップ](object#scenario-step)

[comment]: # ({/a776cebb-e8ca015f})

[comment]: # ({6b938292-6b938292})
### ソース

CHttpTest::create() in *ui/include/classes/api/services/CHttpTest.php*.

[comment]: # ({/6b938292-6b938292})
