Creating zones with the API

Forum for questions and support relating to the 1.30.x releases only.
Locked
tcg
Posts: 46
Joined: Fri Jan 13, 2012 3:41 pm

Creating zones with the API

Post by tcg »

I'm trying to automate creating monitors and zones with the API in version 1.30.4. I have the first part working and can create all the monitors but zones are causing me some problems. I pulled my code straight from the API docs. When I create a zone, I end up with values of "Infinity" and "NaN" in some of the Min/Max fields. I can then go in and select one of the values from the Preset drop down and resave the zone. However, the zone will not work until I move one at least one of the points manually and then resave. When I do that, it computes the area and then starts working. I have quite a few cameras so I'm trying to cut out the manual steps. Any ideas what I might be doing wrong?

Code: Select all

curl -XPOST -b cookies.txt \
  https://zm.example.com/zm/api/zones.json \
  -d "Zone[Name]=Lobby\
&Zone[MonitorId]=1\
&Zone[Type]=Active\
&Zone[Units]=Percent\
&Zone[NumCoords]=4\
&Zone[Coords]=263,134 456,156 456,164 261,143\
&Zone[AlarmRGB]=16711680\
&Zone[CheckMethod]=Blobs\
&Zone[MinPixelThreshold]=25\
&Zone[MaxPixelThreshold]=\
&Zone[MinAlarmPixels]=8\
&Zone[MaxAlarmPixels]=\
&Zone[FilterX]=3\
&Zone[FilterY]=3\
&Zone[MinFilterPixels]=6\
&Zone[MaxFilterPixels]=5\
&Zone[MinBlobPixels]=10\
&Zone[MaxBlobPixels]=\
&Zone[MinBlobs]=1\
&Zone[MaxBlobs]=\
&Zone[OverloadFrames]=0
Attachments
Screenshot from 2018-03-09 07-12-53.png
Screenshot from 2018-03-09 07-12-53.png (20.93 KiB) Viewed 1440 times
Chris
Locked