Stevenls
Stevenls

Reputation: 81

Zabbix API Error when Calling from Cherwell

I am looking at getting Cherwell talking to Zabbix but stumbling at what I understand is the easiest starting point. I have a user setup in Cherwell as part of the webservice which I have confirmed I can log into Zabbix with.

As part of the web call I am performing the basic Zabbix version check.

{
    "jsonrpc": "2.0",
        "method": "apiinfo.version",
        "params": {},
        "id": 1
}

I am getting a -32600 error, Invalid Request, data: the received JSON is not a valid JSON-RPC request. From what I have read you should be able to do this even if you are not authenticated.

I am though getting back a result code of 200 which means the connection is solid but just not returning what I am expecting.

Thanks

Upvotes: 0

Views: 284

Answers (1)

Iron Bishop
Iron Bishop

Reputation: 1988

That error usually means the double quotes are missing, missplaced, or escaped in a wrong way. The code by itself is fine.

@API_URL=https://.../zabbix/api_jsonrpc.php
@CONTENT_TYPE=Content-Type: application/json-rpc

{
    "jsonrpc": "2.0",
    "method": "apiinfo.version",
    "id": 1,
    "params": {}
}

example version request

Upvotes: 1

Related Questions