import_zones_read

To read geofences from a file, use the exchange/import_zones_read method.

Endpoint

Copied!
svc=exchange/import_zones_read&params={
  "eventHash": <text>
}

Parameters

You can include the optional parameter eventHash in the request. It allows specifying the event name which is generated after reading the data.

Uploading a file

To upload a file with geofences, use a POST request with multiple contents (multipart/form-data). For example:

Copied!
Request URL: https://hst-api.wialon.com/wialon/ajax.html?svc=exchange/import_zones_read&sid=SESSION_IDENTIFIER
Request Method: POST
Connection: keep-alive
Content-Length: 1281
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryzmBiAUFQVzA8mRkx
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.3
Accept-Encoding: gzip,deflate,sdch
Accept-Language: ru,en-US;q=0.8,en;q=0.6

------WebKitFormBoundaryzmBiAUFQVzA8mRkx
Content-Disposition: form-data; name="params"

{"eventHash":"jUploadForm1372771850650"}
------WebKitFormBoundaryzmBiAUFQVzA8mRkx
Content-Disposition: form-data; name="eventHash"

jUploadForm1372771850650
------WebKitFormBoundaryzmBiAUFQVzA8mRkx
Content-Disposition: form-data; name="import_file"; filename="geofence.kml"
Content-Type: application/vnd.google-earth.kml+xml


------WebKitFormBoundaryzmBiAUFQVzA8mRkx--

Response

If the request is completed successfully, an empty response is returned.

Copied!
{ }	

To make sure that the geofences have been read, you can execute the avl_evts method:

Copied!
{
  "tm": <uint>,              /* current server time (UTC) */
  "events": [
    {
      "i": -1,
      "d": {                 /* data */
        "hash": <text>,      /* upload complete */
        "zones": [<Object>]  /* array of geofences read */
      }
    }
  ]
}

If the request fails, an error code is returned.

Error codes

Error code Description
1 Invalid or obsolete request SID.
4 No files attached.
7 Failed to fetch the user.

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