Page 1 of 1

API call equivalent to zmpkg.pl status ? states.json bug?

Posted: Thu Mar 25, 2021 1:10 am
by tsp84
Is there an API call to see if zm is running or stopped like zmpkg.pl status? The only thing I saw in docs was to use server.json but if its not a multi server setup it returns empty.

For the states.json bug. If you set the run state to STOP and run zmpkg.pl status it returns stopped, as expected. If you query the API states.json it returns that the previously active run state is still active instead of all of them = 0. ???

Code: Select all

03/24/21 18:47:23.158318 zmpkg[19552].INF [main:319] [Sanity checking States table...]
03/24/21 18:47:23.166702 zmpkg[19552].INF [main:95] [Command: status]
stopped
API returns

Code: Select all

STATES response = {'states': [{'State': {'Id': '1', 'Name': 'default', 'Definition': '', 'IsActive': '0'}}, {'State': {'Id': '8', 'Name': 'Day', 'Definition': '1:Mocord:1,2:Nodect:1,3:Modect:1,4:Modect:1,5:None:1,6:None:1,7:None:1', 'IsActive': '1'}}, {'State': {'Id': '10', 'Name': 'Night', 'Definition': '1:None:1,2:Nodect:1,3:None:1,4:None:1,5:Modect:1,6:Modect:1,7:None:1,8:Mocord:1', 'IsActive': '0'}}]}

Re: API call equivalent to zmpkg.pl status ? states.json bug?

Posted: Thu Mar 25, 2021 1:18 am
by tsp84
ah crap found it after looking in zmNinja source. daemonCheck.json

Re: API call equivalent to zmpkg.pl status ? states.json bug?

Posted: Thu Mar 25, 2021 2:50 am
by tsp84
How about the API call to change to a custom run state? /change/ seems to be just for stop/start/restart of ZM itself.

Re: API call equivalent to zmpkg.pl status ? states.json bug?

Posted: Wed Mar 31, 2021 1:49 pm
by alabamatoy
A cURL call to "https://servername/zm/api/states/change/" . $runstate . ".json" works for me, after all the authentication and such. The value for $runstate must match a predefined runstate name.

I dunno where/how I discovered this. I just looked through the API and it actually is not explicitly documented. An API doc shortcoming, it would seem.

HTH

Re: API call equivalent to zmpkg.pl status ? states.json bug?

Posted: Wed Mar 31, 2021 2:51 pm
by knight-of-ni
alabamatoy wrote: Wed Mar 31, 2021 1:49 pm A cURL call to "https://servername/zm/api/states/change/" . $runstate . ".json" works for me, after all the authentication and such. The value for $runstate must match a predefined runstate name.

I dunno where/how I discovered this. I just looked through the API and it actually is not explicitly documented. An API doc shortcoming, it would seem.

HTH
Please submit a pull request to fix documentation issues. Documentation is something that requires no special programming skills. Anyone can and should help us out in this manner.

This is going to become a big issue after our next release. The UI has been significantly changed, which is going to require many documentation updates and new screenshots.