Here’s the command I’m using:
Code: Select all
curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
Code: Select all
curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
I think the issue is your searching for hosts and not host. That should fix it for you unless you want to pull for hoststatus. I would link to a pdf doc for further information but inside of xi in the help section, there are some pretty good docs for API endpoints and the structure. Have them grab the host section or modify the script to just be host and see if that works.Claying1957 wrote: ↑Fri Mar 07, 2025 3:08 am I’m having trouble with Nagios xi API authentication. I’ve set up the API key and user with permissions, but I’m getting a 401 Unauthorized error when trying to use a curl command.
Here’s the command I’m using:
I’ve double-checked the API key and user permissions, but no luck. Any suggestions?Code: Select all
curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'