Page 1 of 1

Error calling the REST API

Posted: Tue Jun 23, 2020 6:10 am
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

Re: Error calling the REST API

Posted: Tue Jun 23, 2020 9:11 am
by lmiltchev
Can you show us the actual command (API call) that you are using, in addition to the output?

Re: Error calling the REST API

Posted: Wed Jun 24, 2020 3:26 am
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

Re: Error calling the REST API

Posted: Wed Jun 24, 2020 10:09 am
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!

Re: Error calling the REST API

Posted: Thu Jul 16, 2020 2:54 pm
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

Re: Error calling the REST API

Posted: Thu Jul 16, 2020 4:31 pm
by lmiltchev
Thanks for the feedback @umunix!

@alex9000, let us know if the KB article listed in the previous post solves your issue. Thanks!