On this page
httptest.get
Opis
integer/array httptest.get(object parameters)
Ta metoda umożliwia pobieranie scenariuszy WWW zgodnie z podanymi parametrami.
Ta metoda jest dostępna dla użytkowników dowolnego typu. Uprawnienia do wywołania tej metody mogą zostać cofnięte w ustawieniach roli użytkownika. Więcej informacji znajduje się w sekcji Role użytkowników.
Parametry
(object) Parametry definiujące oczekiwany wynik.
Metoda obsługuje następujące parametry.
| Parameter | Type | Description |
|---|---|---|
| groupids | ID/array | Zwracaj tylko web scenarios należące do podanych grup hostów. |
| hostids | ID/array | Zwracaj tylko web scenarios należące do podanych hostów. |
| httptestids | ID/array | Zwracaj tylko web scenarios o podanych ID. |
| inherited | boolean | Jeśli ustawione na true, zwracaj tylko web scenarios odziedziczone z szablonu. |
| monitored | boolean | Jeśli ustawione na true, zwracaj tylko włączone web scenarios należące do monitorowanych hostów. |
| templated | boolean | Jeśli ustawione na true, zwracaj tylko web scenarios należące do szablonów. |
| templateids | ID/array | Zwracaj tylko web scenarios należące do podanych szablonów. |
| expandName | flag | Rozszerz makra w nazwie web scenario. |
| expandStepName | flag | Rozszerz makra w nazwach kroków scenariusza. |
| evaltype | integer | Metoda oceny tagów. Możliwe wartości: 0 - (domyślnie) And/Or; 2 - Or. |
| tags | array | Zwracaj tylko web scenarios z podanymi tagami. Format: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].Pusta tablica zwraca wszystkie web scenarios. Możliwe wartości operator: 0 - (domyślnie) Contains; 1 - Equals; 2 - Does not contain; 3 - Does not equal; 4 - Exists; 5 - Does not exist. |
| selectHosts | query | Zwracaj hosty, do których należy web scenario, jako tablicę w właściwości hosts. |
| selectSteps | query | Zwracaj kroki web scenario w właściwości steps.Obsługuje count. |
| selectTags | query | Zwracaj tagi web scenario w właściwości tags. |
| sortfield | string/array | Sortuj wynik według podanych właściwości. Możliwe wartości: httptestid, name. |
| countOutput | boolean | Te parametry są opisane w komentarzu referencyjnym. |
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
Zwracane wartości
(integer/array) Zwraca:
- tablicę obiektów;
- liczbę pobranych obiektów, jeśli został użyty parametr
countOutput.
Przykłady
Pobieranie scenariusza webowego
Pobierz wszystkie dane o scenariuszu webowym "9".
{
"jsonrpc": "2.0",
"method": "httptest.get",
"params": {
"output": "extend",
"selectSteps": "extend",
"httptestids": "9"
},
"id": 1
}
Odpowiedź:
{
"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
}
Zobacz także
Źródło
CHttpTest::get() w ui/include/classes/api/services/CHttpTest.php.