Page 1 of 1

Can we use JSON with new REST API?

Posted: Tue Jul 19, 2016 8:59 am
by powderbuck
Now that we have fixed the REST API with our 5.2.8 setup, I am wondering if we can pass JSON using POST for the object API?

We already have code that does this, but simple tests make it seem like it's not happy with this:

Using a post to:

https://nagiosxi-pgh02.eagleaccess.com/ ... y=lmcc2lbq

With a body like this:

Code: Select all

{"host_name": "pghorchest04.eagleinvsys.com", "hostgroups": ["PGH_Infrastructure","linux_server"], "max_check_attempts": "3", "check_period": "24x7","notification_interval": "60", "notification_period": "24x7","contacts": ["EagleCSI"], "address": "10.70.7.74"}
Is this possible or does it need to be refactored into:

Code: Select all

host_name=pghorchest04.eagleinvsys.com&hostgroups=linux_server&max_check_attempts=3&check_period&24x7&notification_interval=60&notification_period=24x7&contacts=EagleCSI&address=10.70.7.74
Thanks.

-D

Re: Can we use JSON with new REST API?

Posted: Tue Jul 19, 2016 9:24 am
by tmcdonald
Not seeing it in any of the changelogs, so it likely is not currently in the works for 5.3.0, and barring some undocumented feature I don't believe this is possible in the current API. I asked the devs if it could be added and they said sure - want me to file a feature request?

Re: Can we use JSON with new REST API?

Posted: Tue Jul 19, 2016 10:01 am
by powderbuck
That would be great. I will keep our old code so we can revert back later.

Thanks.

-D

Re: Can we use JSON with new REST API?

Posted: Tue Jul 19, 2016 1:55 pm
by rkennedy
I submitted a feature request for this, ID #9110.

With that said - do you mind if we mark this thread as resolved and lock it up?