Page 1 of 1

Problem calling http://server/zm/api/monitors.json

Posted: Wed Jun 18, 2025 10:40 am
by DavidSingleton
The API documentation says that calling curl http://server/zm/api/monitors.json (naturally with "server" replaced with my server address) should return a list of all monitors. Unfortunately, this does not seem to be the case. After successfully logging in to the server, I get the response "message Monitor Name must be specified for creation, Monitor Name must be specified for creation," After some debugging the ZM PHP code, I find that the error message is generated in the function MonitorsController::add() at around line 126. Am I missing an extra parameter with the call to api/monitors.json?

Incidentally, I am using ZoneMinder version 1.36.34, running Ubuntu 24.04.2 LTS in a VirtualBox virtual machine.

Any help would be much appreciated.

David Singleton

Re: Problem calling http://server/zm/api/monitors.json

Posted: Wed Jun 18, 2025 12:10 pm
by iconnor
That code gets run when you do a POST. Your command line as listed should not be doing a POST. It should be doing a GET. So something is strange. Is that actually the command line you are using?

Re: Problem calling http://server/zm/api/monitors.json

Posted: Thu Jun 19, 2025 1:35 pm
by DavidSingleton
Silly me!!!

When I look at the documentation again, it is obvious that I should use a GET (default) and not a POST (as I used for the login)! I have updated my code, and all now seems to be working as it should.

Many thanks for the help.

Best wishes

David Singleton