Page 1 of 1

can't access api

Posted: Fri Aug 30, 2019 10:26 am
by scheived
Any idea why I can't access the API?

getting <title>404 Not Found</title>

nagiosxi.conf
<Directory "/usr/local/nagiosxi/html">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# AuthName "Nagios XI"
# AuthType Basic
# AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
# Require valid-user
</Directory>

Alias /nagiosxi "/usr/local/nagiosxi/html"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>

Re: can't access api

Posted: Fri Aug 30, 2019 1:32 pm
by benjaminsmith
Hello @scheived,

Just to verify, do you have API access enabled for your user account? Go to Admin > Users > Manage Users and click on your username to check.
API-access.png
If so, can you post the error message to the following API Call ( fill in your IP address/hostaname and API key )? Thanks.

Code: Select all

curl -XGET "<http://ipaddress/nagiosxi/api/v1/system/status?apikey=#abc123#&pretty=1"

Re: can't access api

Posted: Tue Sep 03, 2019 3:37 pm
by scheived
I was using https, change it to http and got it working now.

Re: can't access api

Posted: Tue Sep 03, 2019 3:53 pm
by scottwilkerson
scheived wrote:I was using https, change it to http and got it working now.
great!

Locking