创建
说明
object httptest.create(object/array **webScenarios**)
此方法允许创建新的Web场景。
创建Web场景将自动创建一组web监控项.
参数
(object/array) 要创建的Web场景。
除了 标准Web场景属性之外, 该方法接受以下参数
| 参数 | 类型 | 说明 |
|---|---|---|
| steps (required) | array | Web方案步骤。 |
返回值
(object)返回一个包含“httptestids”属性下创建的Web场景的ID的对象。 返回的ID的顺序与传递的Web方案的顺序相匹配。
示例
创建Web场景
创建一个Web场景来监视公司主页。 该方案将有两个步骤,以检查主页和“关于”页面,并确保它们返回HTTP状态代码200。
Request:
{"jsonrpc": "2.0","method": "httptest.create","params": {"name": "Homepage check","hostid": "10085","steps": [{"name": "Homepage","url": "http://mycompany.com","status_codes": "200","no": 1},{"name": "Homepage / About","url": "http://mycompany.com/about","status_codes": "200","no": 2}]},"auth": "038e1d7b1735c6a5436ee9eae095879e","id": 1}
Response:
{"jsonrpc": "2.0","result": {"httptestids": ["5"]},"id": 1}
参见
来源
CHttpTest::create() in frontends/php/include/classes/api/services/CHttpTest.php.
