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

API changed in .23 or broken?

Post by geraldbrandt »

Hi,

I use the API to change a couple of cameras from Modect to Monitor and back at specific times during the day. It was working in .20, but doesn't work anymore.

Has there been a change, or is there something I can trace to help?

Code: Select all

/usr/bin/curl  -XPOST http://localhost/zm/api/monitors/3.json -d "Monitor[Function]=Modect&Monitor[Enabled]=1"
{"message":"Error"}
Gerald
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post by geraldbrandt »

Still bad in .24

Any help I can give in tracking this down?
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API changed in .23 or broken?

Post by iconnor »

weird... I use this heavily. you can look in /var/log/zm/cake*.log
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post by geraldbrandt »

Here it is:

Code: Select all

2018-01-19 08:15:02 Notice: Notice (8): Use of undefined constant ZM_SERVER_ID - assumed 'ZM_SERVER_ID' in [/usr
Trace:
MonitorsController::edit() - APP/Controller/MonitorsController.php, line 172
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
AppController::invokeAction() - APP/Plugin/Crud/Lib/CrudControllerTrait.php, line 31
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 107
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API changed in .23 or broken?

Post by iconnor »

Ah.. I understand the problem. I'll push a fixed version tonight.
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post by geraldbrandt »

Awesome, thank you!
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post by geraldbrandt »

Still no go, but this may be due to a failed(ish) upgrade (in another post)

Code: Select all

2018-01-20 12:06:52 Error: [ParseError] syntax error, unexpected ']', expecting ',' or ')'
Request URL: /zm/api/monitors/3.json
Stack Trace:
#0 [internal function]: App::load('MonitorsControl...')
#1 [internal function]: spl_autoload_call('MonitorsControl...')
#2 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(266): class_exists('MonitorsControl...')
#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(235): Dispatcher->_loadController(Object(CakeRequest))
#4 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(158): Dispatcher->_getController(Object(CakeRequest), Object(CakeResponse))
#5 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#6 {main}
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API changed in .23 or broken?

Post by iconnor »

Latest packages should fix this.
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken? Still .28

Post by geraldbrandt »

I'm still having issues in .28:

Code: Select all

/usr/bin/curl  -XPOST http://localhost/zm/api/monitors/4.json -d "Monitor[Function]=Modect&Monitor[Enabled]=1"
{"message":"Error"}
There was nothing written to any of the cake logs.

Gerald
geraldbrandt
Posts: 129
Joined: Tue Dec 09, 2014 10:20 pm

Re: API changed in .23 or broken?

Post by geraldbrandt »

Okay, .29 changed it up again!

Code: Select all

root@zoneminder2:~# /usr/bin/curl  -XPOST http://localhost/zm/api/monitors/3.json -d "Monitor[Function]=Monitor&Monitor[Enabled]=1"
{"message":"Error Array\n(\n    [Function] => Array\n        (\n            [0] => Please choose one of the following values : None, Monitor, Modect, Record, Mocord, Nodect\n            [1] => Please choose one of the following values : None, Monitor, Modect, Record, Mocord, Nodect\n        )\n\n)\n"}
The cake logfile is empty (has been since the 20th), so maybe logging got turned off somehow?

Gerald
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API changed in .23 or broken?

Post by iconnor »

Uh... .29 was supposed to fix it... where are you getting your packages from?
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API changed in .23 or broken?

Post by iconnor »

Sigh.. I hate git submodules. New packages building.
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 2:19 am Uh... .29 was supposed to fix it... where are you getting your packages from?
From your repo.deb http://ppa.launchpad.net/iconnor/zonemi ... eas/ubuntu xenial main

Gerald
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 2:26 am Sigh.. I hate git submodules. New packages building.
No worries. I know this is alpha/beta code. I'm using it hoping my testing and feedback will help.

Gerald
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: API changed in .23 or broken?

Post by iconnor »

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