Page 1 of 1

api to add comment

Posted: Wed May 12, 2021 8:26 am
by BanditBBS
Am I blind or is there no endpoint to add a comment? I want our ticketing system to add a comment of the ticket # when it gets an alert from Nagios.

Re: api to add comment

Posted: Wed May 12, 2021 4:41 pm
by benjaminsmith
Hi Bandit,

The way to do that would be to use POST system/corecommand endpoint to send a Core command that will add a comment.

For example:

Code: Select all

curl -XPOST "https://192.168.23.113/nagiosxi/api/v1/system/corecommand?apikey=sCWXTQ3rHtm483AgRUUtLi04v5ECCVmktCCGoU8mINpPPflWafJbRKeGO8fGjUh6" -d "cmd=ADD_HOST_COMMENT;localhost;1;%user%;This is a test comment"
Let me know if that works for you.

Benjamin

Re: api to add comment

Posted: Wed May 12, 2021 6:44 pm
by BanditBBS
This will work, but what permissions are needed? I had a read only user that it wouldn't work even though they had API access. I then changed to this and still get Authentication failed
permissions.jpg
I tried it with my admin user's api key and it works great.

Re: api to add comment

Posted: Thu May 13, 2021 2:10 pm
by ssax
Currently regular users only have access to the objects API endpoint, they would need to be an admin to use the other endpoints (system/config/etc).