In questa pagina
httptest.get
Descrizione
integer/array httptest.get(object parameters)
Il metodo consente di recuperare gli scenari web in base ai parametri specificati.
Questo metodo è disponibile per gli utenti di qualsiasi tipo. Le autorizzazioni per chiamare il metodo possono essere revocate nelle impostazioni del ruolo utente. Per ulteriori informazioni, vedere Ruoli utente.
Parametri
(object) Parametri che definiscono l'output desiderato.
Il metodo supporta i seguenti parametri.
| Parameter | Type | Description |
|---|---|---|
| groupids | ID/array | Restituisce solo i web scenario che appartengono ai gruppi host specificati. |
| hostids | ID/array | Restituisce solo i web scenario che appartengono agli host specificati. |
| httptestids | ID/array | Restituisce solo i web scenario con gli ID specificati. |
| inherited | boolean | Se impostato su true, restituisce solo i web scenario ereditati da un template. |
| monitored | boolean | Se impostato su true, restituisce solo i web scenario abilitati che appartengono a host monitorati. |
| templated | boolean | Se impostato su true, restituisce solo i web scenario che appartengono ai template. |
| templateids | ID/array | Restituisce solo i web scenario che appartengono ai template specificati. |
| expandName | flag | Espande le macro nel nome del web scenario. |
| expandStepName | flag | Espande le macro nei nomi dei passi dello scenario. |
| evaltype | integer | Metodo di valutazione dei tag. Valori possibili: 0 - (predefinito) And/Or; 2 - Or. |
| tags | array | Restituisce solo i web scenario con i tag specificati. Formato: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].Un array vuoto restituisce tutti i web scenario. Valori possibili di operator: 0 - (predefinito) Contains; 1 - Equals; 2 - Does not contain; 3 - Does not equal; 4 - Exists; 5 - Does not exist. |
| selectHosts | query | Restituisce gli host a cui appartiene il web scenario come array nella proprietà hosts. |
| selectSteps | query | Restituisce i passi del web scenario nella proprietà steps.Supporta count. |
| selectTags | query | Restituisce i tag del web scenario nella proprietà tags. |
| sortfield | string/array | Ordina il risultato in base alle proprietà specificate. Valori possibili: httptestid, name. |
| countOutput | boolean | Questi parametri sono descritti nel commento di riferimento. |
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
Valori restituiti
(integer/array) Restituisce uno dei seguenti:
- un array di oggetti;
- il numero di oggetti recuperati, se è stato utilizzato il parametro
countOutput.
Esempi
Recupero di uno scenario web
Recupera tutti i dati relativi allo scenario web "9".
{
"jsonrpc": "2.0",
"method": "httptest.get",
"params": {
"output": "extend",
"selectSteps": "extend",
"httptestids": "9"
},
"id": 1
}
Risposta:
{
"jsonrpc": "2.0",
"result": [
{
"httptestid": "9",
"name": "Homepage check",
"delay": "1m",
"status": "0",
"variables": [],
"agent": "Zabbix",
"authentication": "0",
"http_user": "",
"http_password": "",
"hostid": "10084",
"templateid": "0",
"http_proxy": "",
"retries": "1",
"ssl_cert_file": "",
"ssl_key_file": "",
"ssl_key_password": "",
"verify_peer": "0",
"verify_host": "0",
"headers": [],
"steps": [
{
"httpstepid": "36",
"httptestid": "9",
"name": "Homepage",
"no": "1",
"url": "http://example.com",
"timeout": "15s",
"posts": "",
"required": "",
"status_codes": "200",
"variables": [
{
"name":"{var}",
"value":"12"
}
],
"follow_redirects": "1",
"retrieve_mode": "0",
"headers": [],
"query_fields": []
},
{
"httpstepid": "37",
"httptestid": "9",
"name": "Homepage / About",
"no": "2",
"url": "http://example.com/about",
"timeout": "15s",
"posts": "",
"required": "",
"status_codes": "200",
"variables": [],
"follow_redirects": "1",
"retrieve_mode": "0",
"headers": [],
"query_fields": []
}
]
}
],
"id": 1
}
Vedi anche
Fonte
CHttpTest::get() in ui/include/classes/api/services/CHttpTest.php.