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

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
DavidSingleton
Posts: 3
Joined: Tue Jul 09, 2024 5:03 am

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

Post 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
User avatar
iconnor
Posts: 3390
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

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

Post 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?
DavidSingleton
Posts: 3
Joined: Tue Jul 09, 2024 5:03 am

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

Post 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
Post Reply