Can we use JSON with new REST API?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
powderbuck
Posts: 4
Joined: Tue Oct 28, 2014 4:35 pm

Can we use JSON with new REST API?

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Can we use JSON with new REST API?

Post 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?
Former Nagios employee
powderbuck
Posts: 4
Joined: Tue Oct 28, 2014 4:35 pm

Re: Can we use JSON with new REST API?

Post by powderbuck »

That would be great. I will keep our old code so we can revert back later.

Thanks.

-D
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Can we use JSON with new REST API?

Post 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?
Former Nagios Employee
Locked