Undocumented REST API change

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
johncwelch
Posts: 22
Joined: Mon Jun 15, 2015 8:04 am

Undocumented REST API change

Post by johncwelch »

Okay, so I don't know why this isn't documented, but when you're using the GET objects/host command, with 5.5.1, the return has changed. In 5.4.13, the return you get for that command is:

"hostlist": {
"recordcount": "168",
"host": [
{
With 5.5.x (I'm not sure if this is 5.5.0 or 5.5.1, I'm testing 5.5.1 right now) you get:

"recordcount": "33",
"host": [
{

This causes all kinds of errors since you've changed the hierarchy of the JSON return records. If this was intentional, then please pay more attention to documenting this kind of thing. If this was not, then it's a rather large bug.
johncwelch
Posts: 22
Joined: Mon Jun 15, 2015 8:04 am

Re: Undocumented REST API change

Post by johncwelch »

This also happens with objects/contact
johncwelch
Posts: 22
Joined: Mon Jun 15, 2015 8:04 am

Re: Undocumented REST API change

Post by johncwelch »

and objects/hostgroup
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Undocumented REST API change

Post by lmiltchev »

If this was intentional, then please pay more attention to documenting this kind of thing. If this was not, then it's a rather large bug.
I just had a word from our developers, who confirmed that this change was intentional. The documentation will be updated in 5.5.2, which should be coming out soon.
Be sure to check out our Knowledgebase for helpful articles and solutions!
johncwelch
Posts: 22
Joined: Mon Jun 15, 2015 8:04 am

Re: Undocumented REST API change

Post by johncwelch »

lmiltchev wrote:
If this was intentional, then please pay more attention to documenting this kind of thing. If this was not, then it's a rather large bug.
I just had a word from our developers, who confirmed that this change was intentional. The documentation will be updated in 5.5.2, which should be coming out soon.
Okay. Can y'all please not just change stuff without documenting it? doing the error trapping wasn't hard, but not knowing why I was getting errors that made no sense and worked on 9 other servers is a bit frustrating.

APIs can't just arbitrarily change without notice like that, not if you want people to use and rely on them.
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: Undocumented REST API change

Post by jomann »

I understand it causes issues to have changes like this happen. You're right the docs should have been updated, and we try to make sure we catch everything but sometimes it doesn't get caught.

As for the changes in the API, this is one of the biggest releases of XI we've ever had. A lot changed behind the scenes, and the change is related to some back-end changes that were needed to improve usability and stability in XI, and it happened to remove the list portion of the object.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
johncwelch
Posts: 22
Joined: Mon Jun 15, 2015 8:04 am

Re: Undocumented REST API change

Post by johncwelch »

okay, another one. I notice in Fusion that I can add AD/LDAP users, but when I go to look in the help for REST APIs in Nagios XI 5.5.2, there's no documentation/help for adding users at all. Is this going to be changed soon?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Undocumented REST API change

Post by lmiltchev »

I was told by @jomann that the documentation for adding AD/LDAP users will be added to the next release of Fusion. Currently, there is an example, showing how to add a "local" user only.

Adding AD/LDAP users is done is a similar way. Here's a couple of examples:

Code: Select all

curl -XPOST "http://x.x.x.x/nagiosfusion/api/v1/system/user?apikey=5ljksid8krdibrv2eo6jaa8vadij47d8ptqmd7r2v8jb3hce7h2go9d2mtkn4vvs&pretty=1" -d "username=jmcdouglas&password=test&name=Jordan%20McDouglas&email=jmcdouglas@localhost&dateformat=1&number_format=1&auth_level=user&auth_server_id=5a7b3b87cdc4e&allow_local=0&ad_username=jmcdouglas&email_info=0&auth_type=ad" 

curl -XPOST "http://x.x.x.x/nagiosfusion/api/v1/system/user?apikey=5ljksid8krdibrv2eo6jaa8vadij47d8ptqmd7r2v8jb3hce7h2go9d2mtkn4vvs&pretty=1" -d "username=jmcdouglas&password=test&name=Jordan%20McDouglas&email=jmcdouglas@localhost&dateformat=1&number_format=1&auth_level=user&auth_server_id=5a7b3b950fd7f&allow_local=0&ldap_dn=cn%3Djmcdouglas%2Cou%3DTeam%2Cdc%3DNagios%2Cdc%3Dcom&email_info=0&auth_type=ldap"
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked