Output of PHP using the API to delete a host:
CURL URL: http://zabbix01/api_jsonrpc.php
CURL Options: Array
(
[19913] => 1
[13] => 30
[78] => 5
[81] =>
[64] =>
[52] => 1
[74] => 1
[10023] => Array
(
[0] => Content-Type: application/json-rpc
[1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api
)
[10036] => POST
[10015] => {"auth":null,"method":"user.authenticate","id":1,"params":
,"jsonrpc":"2.0"}
[10102] => gzip
)
Got response from API: (
)
Deleting host Zabbix server
CURL URL: http://zabbix01/api_jsonrpc.php
CURL Options: Array
(
[19913] => 1
[13] => 30
[78] => 5
[81] =>
[64] =>
[52] => 1
[74] => 1
[10023] => Array
(
[0] => Content-Type: application/json-rpc
[1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api
)
[10036] => POST
[10015] => {"auth":"75e096eefd4761c213a06c30876c8367","method":"host.delete","id":1,"params":
,"jsonrpc":"2.0"}
[10102] => gzip
)
Got response from API: ({"jsonrpc":"2.0","error":
,"id":1})
Response decoded: (Array
(
[jsonrpc] => 2.0
[error] => Array
(
[code] => -32500
[message] => Application error.
[data] => [ CHost::delete ] You do not have permission to perform this operation
)
[id] => 1
)
User "api" is Super admin and has API access. Creating and deleting hostgroups works fine.
- duplicates
-
ZBX-3221 Can't delete host through API
- Closed