Page 2 of 2

Re: API changed in .23 or broken?

Posted: Tue Jan 30, 2018 3:12 pm
by geraldbrandt
iconnor wrote: Tue Jan 30, 2018 3:40 am I feel like I'm quashing some of the really hard long-standing wierd bugs. I'm going to lay off any new features for a while and just put polish on it.
Thanks for your patience.
If poking around a strange server helps, I can set up an ssh account for temp access.

Gerald

Re: API changed in .23 or broken?

Posted: Wed Jan 31, 2018 2:16 pm
by geraldbrandt
This now works since the last update! Thank you!

Re: API changed in .23 or broken?

Posted: Wed Jan 31, 2018 2:49 pm
by rockedge
@ iconner relax...all systems are "Go"....... lots of progress happening here... good work by the way! :D

Re: API changed in .23 or broken?

Posted: Sun Feb 04, 2018 8:24 pm
by sagitt
I done this bash script for authentication:

Code: Select all

#!/bin/sh
username="USER"
password="PASSWORD"
host="http://localhost:PORT/zm"
file="/etc/zm/cookie.txt"

case "$1" in
	'statusid')
		if [ -e $file ]; then
  			echo "WARNING: Cookie file: $file already exist... Using it!"
		else
   			echo "WARNING: Cookie file: $file does not exist... Creating it!"
			curl -d "username=$username&password=$password&action=login&view=console" -c $file $host/index.php
			sleep 1
			chmod 600 $file
			echo Cookie file: $file created.
		fi
		curl -b $file -XPOST $host/api/monitors/$2.json -d "Monitor[Function]=$3&Monitor[Enabled]=$4"
		echo Changed ID $2 ZoneMinder monitor status to $3 now.

	;;
	'makecookie')
		if [ -e $file ]; then
  			echo "WARNING: Cookie file: $file already exist... Overwriting it!"
		else
   			echo "WARNING: Cookie file: $file does not exist... Creating it!"
		fi
		curl -d "username=$username&password=$password&action=login&view=console" -c $file $host/index.php
		sleep 1
		chmod 600 $file
		echo Cookie file: $file created.
	;;
	'deletecookie')
		if [ -e $file ]; then
  			echo "WARNING: Cookie file: $file exist... Deleting it!"
			rm $file
			echo Cookie file: $file deleted.
		else
   			echo "WARNING: Cookie file: $file does not exist... Can't delete it!"
		fi
	;;
	'info')
		echo "Use statusid <ID> <None|Monitor|Modect|Record|Mocord|Nodect> <0|1> parameters to change monitor status or makecookie\deletecookie to manage cookie file manually"
	;;
	*)
		echo "Usage: $0 {statusid|makecookie|deletecookie|info}"
		exit 1
	;;
esac

exit 0