API with Zabbix

Has anyone already done integration with API in Bubble with Zabbix

Has anyone already done integration with API in Bubble with Zabbix.

Yes. It’s been a while – I believe it was Zabbix v5. It was a pain in the ass, I wasn’t quite well versed in APIs back then, and it’s all JSON-RPC which was weird because my degree at YouTube university never made me learn anything like that.

2 Likes

:sweat_smile: ok but can you give me any tips on how to do it?

Sure. What have you tried? Where are you stuck?

I am having difficulties configuring AUTHENTICATION.
I have a username and password and I need to get a TOKEN…
{
“jsonrpc”: “2.0”,
“method”: “user.login”,
“params”: {
“user”: “Admin”,
“password”: “zabbix”
},
“id”: 1,
“auth”: null
}
RESPONSE:
{
“jsonrpc”: “2.0”,
“result”: “0424bd59b807674191e7d77572075f33”,
“id”: 1
}
so … I can’t connect in the server …

POST http://company.com/zabbix/api_jsonrpc.php HTTP/1.1
       Content-Type: application/json-rpc
       {"jsonrpc":"2.0","method":"apiinfo.version","id":1,"auth":null,"params":{}}

You got a token. :partying_face:
Now, save that token and use it in the subsequent calls. Look at the Auth Methods.

You can make a call like:

curl --request POST \
    --url 'https://example.com/zabbix/api_jsonrpc.php' \
    --header 'Authorization: Bearer 0424bd59b807674191e7d77572075f33'

And the body is your JSON-RPC

{
    "method": "widget.create",
    ...
}

By the way, when posting code in the forum, you can wrap your code in ``` triple back-ticks to show it in a ‘nicer’ format.

I think we have connection problems with the server… I’ll look into it…
thanks
There was an issue setting up your call.

Raw response for the API
Status code 404

404 Not Found

404 Not Found


nginx/1.24.0

yes @rico.trevisan I made it. but just writing the JSON code, do you remember how I can do this using headers and parameters?
example:
{
“jsonrpc”: “2.0”,
“method”: “user.get”,
“params”: {
“output”: “extend”
},
“id”: 1
}
where do I use the method? in the url or in parameters?

That’s all in the body. If I’m not mistaken in JSON-RPC all these calls are POST.

Thank you my friend! I achieved.
I really appreciate your help.
compliments

Excellent. If it was one of my answers, hit it with that " :white_check_mark: solution" button. Both :heart: and :white_check_mark: fuel my fragile ego.

1 Like