httptest.create
Description
object httptest.create(object/array webScenarios)
This method allows to create new web scenarios.
Creating a web scenario will automatically create a set of web monitoring items.
This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object/array) Web scenarios to create.
Additionally to the standard web scenario properties, the method accepts the following parameters.
Valori di ritorno
(object) Restituisce un oggetto contenente gli ID degli scenari web creati
sotto la proprietà httptestids. L'ordine degli ID restituiti corrispondono all'ordine degli scenari Web passati.
Esempi
Creating a web scenario
Create a web scenario to monitor the company home page. The scenario will have two steps, to check the home page and the "About" page and make sure they return the HTTP status code 200.
Request:
{
"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
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"httptestids": [
"5"
]
},
"id": 1
}
Guarda anche
Fonte
CHttpTest::create() in ui/include/classes/api/services/CHttpTest.php.