API picture to email

Forum for questions and support relating to the 1.29.x releases only.
Locked
tchinou1
Posts: 2
Joined: Thu Mar 03, 2016 1:55 pm

API picture to email

Post by tchinou1 »

Hi guys ! I want to use the API to ask ZoneMinder to take a picture of a monitor and send it to me via email. Does anybody know how to do that ?

Thanks ! :)
rockedge
Posts: 1198
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: API picture to email

Post by rockedge »

if you send this URL for example :

Code: Select all

http://your_zm_url/cgi-bin/nph-zms?mode=single&scale=100&maxfps=5&buffer=1000&monitor=2&user=admin&connkey=946936&rand=1460641666
it will take a single snap shot. Notice the mode=single which usually is mode=jpeg. AUTH_RELAY is set to none with the auth activated and monitor 2 is selected.
Maybe a script to take the snap shot and send the image to an email address fired by Cron job? there are other ways including using the API I think.
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: API picture to email

Post by knight-of-ni »

If you have authentication turned on, the URL should look like this:

Code: Select all

http://your_zm_url/{PATH_ZMS}?mode=single&scale=100&monitor={ID}&user={USERNAME}&pass={PASSOWRD}
PATH_ZMS - found under options. different for every distro.
ID - the monitor id of your monitor as shown on the web console (hover over the link)
USERNAME- Username of a restricted account you created under Options. This will be visible in plain text.
PASSWORD - Password of the restricted you created under Options. This will be visible in plain text.

Optionally, you can change the scale in the url to something other than 100.

My only gripe is Weather Underground does not accept this as a valid image because the url does not end in .jpg.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Locked