To create, edit or delete geofences, use the command resource/update_zone:
svc=resource/update_zone¶ms={"itemId":<long>, "id":<long>, "callMode":<text>, "n":<text>, "t":<int>, "w":<int>, "p":[{ "x":<double>, "y":<double>, "r":<int> }], "d":{ "addr":<unit>, "rideBegin":<uint>, "rideEnd":<uint>, "color":<uint> }}
Name | Description |
---|---|
itemId | resource ID |
id | geofence ID |
callMode | action: create, update, delete |
Parameters required only for create and update: | |
n | geofence name |
t | type: 1 - line, 2 - polygon, 3 - circle |
w | line thickness or circle radius |
p | array of geofence points |
x | longitude |
y | latitude |
r | radius |
d | description |
addr | address source: 0 - no, 1 - yes |
rideBegin | ride beginning: 0 - no, 1 - yes |
rideEnd | ride end: 0 - no, 1 - yes |
color | color (ARGB) |
On create and edit:
[ <long>, /* geofence ID */ { "n":<text>, /* name */ "id":<long>, /* ID */ "t":<int>, /* type: 1 - line, 2 - polygon, 3 - circle */ "d":<int> /* line thickness or circle radius */ "dr":{ /* description */ "addr":<uint>, /* address source: 0 - no, 1 - yes */ "rideBegin":<uint>, /* ride beginning: 0 - no, 1 - yes */ "rideEnd":<uint>, /* ride end: 0 - no, 1 - yes */ "color":<uint>, /* color (ARGB) */ } } ]
On delete:
[ <long>, /* geofence ID */ null ]
Code | Value |
---|---|
1 | invalid session |
2 | invalid service name |
3 | invalid result |
4 | - invalid format or value of parameters - error updating geofence |
6 | - geofence with current ID doesn't exist - error deleting geofence - error updating geofence |
7 | - access denied - service is not activated |
|