Error calling the REST API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
alex9000
Posts: 9
Joined: Mon Jun 22, 2020 5:08 am

Error calling the REST API

Post by alex9000 »

Hello,

every time our Nagios REST API is called, we receive this error at the beginning of the response:
<p><pre>SQL Error [nagiosxi] : ERROR: syntax error at or near "objects"
LINE 1: ...6-23 13:07:12','API','jenkins',16,'API endpoint \'objects/ho...
^</pre></p>

Nevertheless the call is successful, but some tools get confused with this first lines.

Do you know where this is comming from?

Nagios: 5.7.1

We also tried repairing the database with your script, but the error is still coming up.

Thank you.

BR,
Alex
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Error calling the REST API

Post by lmiltchev »

Can you show us the actual command (API call) that you are using, in addition to the output?
Be sure to check out our Knowledgebase for helpful articles and solutions!
alex9000
Posts: 9
Joined: Mon Jun 22, 2020 5:08 am

Re: Error calling the REST API

Post by alex9000 »

I am getting this error with each call to the API and also calling the API with a browser and also with CURL

e.g. call
nagiosxi/api/v1/objects/hostavailability?apikey=XXXXXXX8&pretty=1&hostgroup=XXXXX
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Error calling the REST API

Post by lmiltchev »

I haven't been able to replicate the issue in house - the same API call works for me in 5.7.1. Can you PM me your profile? We will review it to see if we are going to find any clues/errors. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
umunix
Posts: 21
Joined: Thu Dec 12, 2013 1:43 pm

Re: Error calling the REST API

Post by umunix »

We had the same issue after upgrading to XI 5.7.1

The issue turned out to be related to the following problem:

https://support.nagios.com/kb/article/n ... r-754.html

The resolution suggested in the article solved the error from being displayed with the JSON output from the API
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Error calling the REST API

Post by lmiltchev »

Thanks for the feedback @umunix!

@alex9000, let us know if the KB article listed in the previous post solves your issue. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked