Good day.
when accessing zabbix api from powershell, an error is constantly displayed:
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Field "eventsource" is mandatory."},"id":2}
although "eventsource" is specified:
What am I doing wrong?
when accessing zabbix api from powershell, an error is constantly displayed:
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Field "eventsource" is mandatory."},"id":2}
although "eventsource" is specified:
Code:
$params = @{
body = @{
"jsonrpc"= "2.0"
"method"= "action.create"
"params"= @{
"name"="m3"
"eventsource"=2
"status"="0"
"esc_period"=60
"def_shortdata"="Auto registration: {HOST.HOST}"
"def_longdata"="Host name: {HOST.HOST}\r\nHost IP: {HOST.IP}\r\nAgent port: {HOST.PORT}"
"conditions"=@{"conditiontype"="24"
"operator"="2"
"value"="m3"}
"operations"=@{"esc_step_from"=1
"esc_period"=60
"optemplate"=@{"templateid"="12103"}
"operationtype"=6
"esc_step_to"=1}
}
"id"= 2
"auth"= ($auth.Content | ConvertFrom-Json).result} | ConvertTo-Json
uri = "$baseurl/api_jsonrpc.php"
headers = @{"Content-Type" = "application/json"}
method = "Post"}
$result = Invoke-WebRequest @params
$result.Content
Comment