API changed in .23 or broken?

Forum for questions and support relating to the 1.31.x releases only.
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post 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
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post by geraldbrandt »

This now works since the last update! Thank you!
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: API changed in .23 or broken?

Post by rockedge »

@ iconner relax...all systems are "Go"....... lots of progress happening here... good work by the way! :D
sagitt
Posts: 39
Joined: Mon Apr 30, 2012 1:13 pm

Re: API changed in .23 or broken?

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