API configuration is incorrect

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
KaptanFranje
Posts: 9
Joined: Thu Aug 22, 2024 1:13 pm

API configuration is incorrect

Post by KaptanFranje »

I have zm 1.36.12 running on an UBUNTU (22.04.4 LTS) server. zm works more or less, but I cannot connect from zmninja. "Login validated but API failed." I spent several ours on the net, but so far without success.
Checking API version, gives the following result (192.168.100.18 is the local ip address of my machine):
http://192.168.100.18/zm/api/monitors.json
Not Found
The requested URL was not found on this server.
Apache/2.4.52 (Ubuntu) Server at 192.168.100.18 Port 80
Api is enabled for all users, I have enabled OPT_USE_API, LEGACY API, have the HASH, etc.

I read many places that Apache server has to be set somehow, but I never found how.
User avatar
iconnor
Posts: 3335
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API configuration is incorrect

Post by iconnor »

It could be at /api instead of /zm/api... or it might not be configured at all.

yes check your apache config, typically in /etc/apache2/conf-enabled/zoneminder.conf

Here is mine
https://gist.github.com/connortechnolog ... 54ee45067e
KaptanFranje
Posts: 9
Joined: Thu Aug 22, 2024 1:13 pm

Re: API configuration is incorrect

Post by KaptanFranje »

Thank you!

I tried tough, but it did not work. :(
Same error message, plus I lost the video stream/thumbnails in the zm web site...
I am going back to my old config...
Any other idea?
User avatar
burger
Posts: 458
Joined: Mon May 11, 2020 4:32 pm

Re: API configuration is incorrect

Post by burger »

I posted an explanation of how the API redirects work here:
https://wiki.zoneminder.com/API#Configu ... bserver%22
The explanation is for Lighttpd, but it's a good walkthrough of what is going on with CakePHP and apache/nginx/etc.
You should have something specifically for the API urls in your apache config and if you don't,
then you will need to find the correct config. The "URL not found" error probably means that
the redirects aren't configured correct, assuming that you have the CakePHP files in /usr/share/zoneminder/www/api
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
User avatar
burger
Posts: 458
Joined: Mon May 11, 2020 4:32 pm

Re: API configuration is incorrect

Post by burger »

Try this config. The gist doesn't work for me, but this one does.
https://wiki.zoneminder.com/API#Example ... inder.conf
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Post Reply