import_zones_save

To import geofences, use the exchange/import_zones_save method.

Endpoint

Copied!
svc=exchange/import_zones_save&params={
  "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>
        }
      ]
    }
  ]
}

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:

Copied!
<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:
  • resource with the specified ID doesn’t exist,
  • the user doesn’t have the Create, edit, and delete geofences access right to the resource,
  • failed to fetch user.

If you find a mistake in the text, please select it and press Ctrl+Enter.