import_zones_save
To import geofences, use the exchange/import_zones_save method.
Endpoint
svc=exchange/import_zones_save¶ms={
"itemId": <long>,
"zones": [
{
"n": <text>,
"d": <text>,
"id": <long>,
"t": <byte>,
"w": <uint>,
"f": <uint>,
"c": <uint>,
"b": {
"min_x": <double>,
"min_y": <double>,
"max_x": <double>,
"max_y": <double>,
"cen_x": <double>,
"cen_y": <double>
},
"p": [
{
"x": <double>,
"y": <double>,
"r": <uint>
}
]
}
]
}
The method is a resource-intensive request, so the limit on simultaneous resource-intensive requests during one session applies to it. If the limit is reached, the error 1003 with the
LIMIT api_concurrentreason is returned. For the list of resource-intensive requests, see Limitations.
Parameters
| Parameter | Description |
|---|---|
itemId |
Resource ID in the system. |
id |
Geofence ID in the system. |
zones |
Array of geofence IDs. |
You can find the description of other parameters on the get_zone_data page.
In geofence description the following parameters are required: n (geofence name), t (geofence type), w (line thickness or circle radius), f (flags), c (color), p (geofence points). The other geofence parameters are useful, but optional. The itemId parameter (resource ID) is required.
Response
If the request is completed successfully, the number of imported geofences is returned:
<int>
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 1 | Invalid or obsolete request SID. |
| 4 | Parameter validation error. |
| 6 | No geofence IDs specified. |
| 7 | One of the following errors:
|