User Manual
Version 7.6
×

Add geofence

 
Parameters:
cmd : geofenceadd
zonename: name of geofence
zonetype: geofence type (1 - polygon, 2 - circle)
color:  color in  HEX ( #FFFFFF )
info: additional info
group_name: geofences group name. If not exists it will be created. (optional if group_id set) 
group_id: ID of geofences group. (optional if   group_name persists) If this parameter set - group_name ignored
geometry: GEOJson with circle or polygon geometry, depending on zonetype
external_id: external geofence id (optional)
 
Request:
polygon
https://<address>/api/api.php?cmd=geofenceadd&zonetype=1&zonename=test_api_polygon&external_id=12354&info=blabla&color=%23FF3300&group_name=TEST_API&geometry={%22type%22:%22Polygon%22,%22coordinates%22:[[[55.184334,25.112866],[55.183512,25.113472],[55.182154,25.112516],[55.183511,25.111016],[55.184923,25.112133]]]}
 
circle
https://<address>/api/api.php?cmd=geofenceadd&zonetype=2&zonename=test_api_circle&external_id=12345&info=circle_info&color=%23FF3300&group_name=TEST_API&geometry={%22type%22:%22Circle%22,%22coordinates%22:[55.184334,25.112866],%22radius%22:150}
 
Answer:
{
  "code":0,
  "msg":"OK",
  "data":{
    "id":158412,
    "zonename":"test_api_polygon",
    "zonetype":1,
    "external_id":"12354",
    "created_at":1610536445,
    "updated_at":1610536445,
    "color":"#FF3300",
    "info":"blabla",
    "group_id":6984
  }
}