Adding Monitors via Web Interface vs API - WebGUI differs from API Defaults
Posted: Thu Jun 01, 2023 8:21 am
Hello again,
I'm writing a script to configure ZM and ran across some things to note.
I only wanted to send the basic amount of information through the api to setup a monitor like on the web interface. I determined these are the values most important for now:
curl -XPOST http://localhost/zm/api/monitors.json -d "Monitor[Name]=Office\
&Monitor[Id]=1\
&Monitor[Type]=Ffmpeg\
&Monitor[Function]=Mocord\
&Monitor[RefBlendPerc]=6\
&Monitor[AlarmRefBlendPerc]=6\
&Monitor[Method]=rtpRtsp\
&Monitor[Path]=rtsp://10.0.0.21:7447/645410d8e4b0db099c349744_0\
&Monitor[Width]=1280\
&Monitor[Height]=720\
&Monitor[SaveJPEGs]=0\
&Monitor[VideoWriter]=2\
&Monitor[RecordAudio]=1"
I did a comparison to the defaults used in the webgui vs the api. In order to get the same defaults the webgui uses, I had to add the additional parameters:
&Monitor[Colours]=4\
&Monitor[ServerId]=0\
&Monitor[V4LCapturesPerFrame]=1\
&Monitor[Encoder]=auto\
&Monitor[EncoderParameters]=crf=23\
&Monitor[RTSPDescribe]=false\
&Monitor[LabelFormat]=%N - %d\/%m\/%y %H:%M:%S\
&Monitor[PreEventCount]=5\
&Monitor[PostEventCount]=5\
&Monitor[FPSReportInterval]=100\
&Monitor[ControlAddress]=user:port@ip\
&Monitor[DefaultScale]=0\
&Monitor[WebColour]=#7563cc\
&Monitor[Sequence]=1"
This is a list of the default API settings that differ from the webgui:
"Notes":null,
"ServerId":null,
"Device":"''",
"V4LCapturesPerFrame":null,
"Colours":"1",
"Encoder":null,
"EncoderParameters":null,
"RTSPDescribe":null,
"LabelFormat":null,
"PreEventCount":"10",
"PostEventCount":"10",
"FPSReportInterval":"250",
"ControlAddress":null,
"DefaultScale":"100",
"SignalCheckColour":"#0000BE",
"WebColour":"red",
"Sequence":null,
Looks like the api doesn't assign random "webcolour" either and I'll need to specify for each camera.
I'll be diving into each setting that's not obvious for myself later. Yes, I know some don't really matter, but wanted to make a note, as I may help in making this more efficient later. I also wanted feedback from anyone that sees an issue here and more familiar with the options.
I'm writing a script to configure ZM and ran across some things to note.
I only wanted to send the basic amount of information through the api to setup a monitor like on the web interface. I determined these are the values most important for now:
curl -XPOST http://localhost/zm/api/monitors.json -d "Monitor[Name]=Office\
&Monitor[Id]=1\
&Monitor[Type]=Ffmpeg\
&Monitor[Function]=Mocord\
&Monitor[RefBlendPerc]=6\
&Monitor[AlarmRefBlendPerc]=6\
&Monitor[Method]=rtpRtsp\
&Monitor[Path]=rtsp://10.0.0.21:7447/645410d8e4b0db099c349744_0\
&Monitor[Width]=1280\
&Monitor[Height]=720\
&Monitor[SaveJPEGs]=0\
&Monitor[VideoWriter]=2\
&Monitor[RecordAudio]=1"
I did a comparison to the defaults used in the webgui vs the api. In order to get the same defaults the webgui uses, I had to add the additional parameters:
&Monitor[Colours]=4\
&Monitor[ServerId]=0\
&Monitor[V4LCapturesPerFrame]=1\
&Monitor[Encoder]=auto\
&Monitor[EncoderParameters]=crf=23\
&Monitor[RTSPDescribe]=false\
&Monitor[LabelFormat]=%N - %d\/%m\/%y %H:%M:%S\
&Monitor[PreEventCount]=5\
&Monitor[PostEventCount]=5\
&Monitor[FPSReportInterval]=100\
&Monitor[ControlAddress]=user:port@ip\
&Monitor[DefaultScale]=0\
&Monitor[WebColour]=#7563cc\
&Monitor[Sequence]=1"
This is a list of the default API settings that differ from the webgui:
"Notes":null,
"ServerId":null,
"Device":"''",
"V4LCapturesPerFrame":null,
"Colours":"1",
"Encoder":null,
"EncoderParameters":null,
"RTSPDescribe":null,
"LabelFormat":null,
"PreEventCount":"10",
"PostEventCount":"10",
"FPSReportInterval":"250",
"ControlAddress":null,
"DefaultScale":"100",
"SignalCheckColour":"#0000BE",
"WebColour":"red",
"Sequence":null,
Looks like the api doesn't assign random "webcolour" either and I'll need to specify for each camera.
I'll be diving into each setting that's not obvious for myself later. Yes, I know some don't really matter, but wanted to make a note, as I may help in making this more efficient later. I also wanted feedback from anyone that sees an issue here and more familiar with the options.