Page 1 of 1

Setting Archived Variable in Python?

Posted: Mon Jan 15, 2024 6:02 am
by MohanDavid
How can I set the 'Archived' variable in my custom Python alert module, which sends alerts based on importance, and utilizes a returned JSON, while struggling to find information on archiving events in the passed URL filter?

Re: Setting Archived Variable in Python?

Posted: Tue Jan 16, 2024 3:45 pm
by burger
The API has the index function, and the search function. See: https://github.com/ZoneMinder/zoneminde ... troller.ph

To do this with index, you would use:

Code: Select all

curl -X POST -d "user=username&pass=password" http://localhost/zm/api/events/index/Archived:1.json
Note that this returns the first page of events, and you have to cycle through the pages per:
https://zoneminder.readthedocs.io/en/st ... all-events

So that is not the right way to do this. Instead use search which will return only the events that are archived:

Code: Select all

curl -X POST -d "user=username&pass=password" http://localhost/zm/api/events/search/Archived:1.json
For more details see:
https://zoneminder.readthedocs.io/en/stable/api.html
https://wiki.zoneminder.com/API