The requested address '/zm/api/' was not found on this server.

Forum for questions and support relating to 1.33.x development only.
Post Reply
simonpg
Posts: 5
Joined: Fri Nov 29, 2019 8:55 pm

The requested address '/zm/api/' was not found on this server.

Post by simonpg » Sat Nov 30, 2019 1:58 am

I have installed ZM 1.33.14 on clean Debian Buster.
All went well. I just upgraded to 1.33.15 and that went well.
My problem is with the API. I have attached a picture of what I get when I reference the URL: .../zm/api

When I reference the URL .../api/host/getVersion.json, I get:
{"success":false,"data":{"name":"Not Authenticated","message":"Not Authenticated","url":"\/zm\/api\/host\/getVersion.json","exception":{"class":"UnauthorizedException","code":401,"message":"Not Authenticated"}}}

This is my first time with ZoneMinder and it is remarkable!
Attachments
Annotation 2019-11-29 173548.png
Annotation 2019-11-29 173548.png (71.92 KiB) Viewed 270 times

User avatar
snake
Posts: 254
Joined: Sat May 21, 2016 2:20 am

Re: The requested address '/zm/api/' was not found on this server.

Post by snake » Sat Nov 30, 2019 3:50 am

That is expected for the path /zm/api, as I noticed that recently. Or at least, it appears to be setup right.

Try adding authentication to the http request.
e.g.

Code: Select all

curl -XPOST -d "user=admin&pass=password" http://<ipaddress>/zm/api/host/getVersion.json

simonpg
Posts: 5
Joined: Fri Nov 29, 2019 8:55 pm

Re: The requested address '/zm/api/' was not found on this server.

Post by simonpg » Sat Nov 30, 2019 4:17 am

Thank you for the timely reply! Alas, No Joy.
Attachments
Annotation 2019-11-29 201455.png
Annotation 2019-11-29 201455.png (40.27 KiB) Viewed 258 times

User avatar
snake
Posts: 254
Joined: Sat May 21, 2016 2:20 am

Re: The requested address '/zm/api/' was not found on this server.

Post by snake » Sat Nov 30, 2019 5:17 pm

What guide did you use to install? Is this on arm or x86/64?

Try the following per: https://wiki.zoneminder.com/Debian_8_64 ... ldid=14763
(This used to be required, I'm not sure if it is anymore...)

Code: Select all

chown -R www-data:www-data /usr/share/zoneminder/

Edit /etc/apache2/conf-enabled/zoneminder.conf
nano /etc/apache2/conf-enabled/zoneminder.conf
Add at the bottom:

<Directory /usr/share/zoneminder/www/api>
    AllowOverride All
</Directory>
If that doesn't work, see https://github.com/pliablepixels/zmNinj ... r-with-API

simonpg
Posts: 5
Joined: Fri Nov 29, 2019 8:55 pm

Re: The requested address '/zm/api/' was not found on this server.

Post by simonpg » Sat Nov 30, 2019 10:50 pm

"What guide did you use to install? Is this on arm or x86/64?"

Those are excellent questions! I'm sorry you had to ask them. The Guide:

https://wiki.zoneminder.com/Debian_10_B ... pro_Master

The architecture is x86_64.

I applied the suggested changes, and still No Joy.

Pliablepixels says, "if you find the page empty, your APIs/permissions have a problem." I did indeed find just JSON.

simonpg
Posts: 5
Joined: Fri Nov 29, 2019 8:55 pm

Re: The requested address '/zm/api/' was not found on this server.

Post by simonpg » Tue Dec 03, 2019 4:29 am

I turned off authentication (unchecked OPT_USE_AUTH), and I get Not Found instead of Not Authenticated for the same URL.

simonpg
Posts: 5
Joined: Fri Nov 29, 2019 8:55 pm

Re: The requested address '/zm/api/' was not found on this server.

Post by simonpg » Tue Dec 03, 2019 4:36 am

Some news: zm/api/host/getVersion.json returns {"version":"1.33.15","apiversion":"2.0"} with authentication off.

rockedge
Posts: 1113
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: The requested address '/zm/api/' was not found on this server.

Post by rockedge » Mon Dec 09, 2019 2:48 am

Turn the authentication back on.
Login into the ZM web console with the browser, open a new tab and use the URL http://your_ip/zm/api/host/getVersion.json and
you will see the return:

Code: Select all

{"version":"1.33.15","apiversion":"2.0"}
this return means the API is working as expected.

what your error message is telling us is that on your first attempt you were not logged in so there wasn't a proper login cookie created and the API returned "not authorized" which is a security feature. Once you had turned off the authorization the API did not need an authorization so it returned the proper response.

when you used /zm/api, this URL will return an error page because for better security the debug is turned off and this url is inaccessible from a browser and when you have the browser logged in to ZM and try zm/api/ you will receive an error notification, this is also for security reasons.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests