export_zones

To export geofences to a KML or KMZ file, use the exchange/export_zones command .

Copied!
svc=exchange/export_zones&params={"fileName":<text>,
				  "zones":[
					{
						"itemId":<long>,
						"id":<long>
					}
				 ],
				 "compress":<bool>}

This request can’t be executed simultaneously with any request from this chapter and the following requests:

Parameters

NameDescription

fileName

File name.

zones

Array of geofences.

itemId

Resource ID.

id

Geofence ID.

compress

Specify 1 to compress the file, or 0 to get the uncompressed file.

Response

If the request is completed successfully, a KML or KMZ file is returned.

Currently, if the resource or geofence with the specified ID is not found on the server, a XML response with the file name is generated:

Request

Copied!
{"fileName":"export_zones_result","zones":[{"itemId":<nonexisting-resource-id>,"id":<nonexisting-geofence-id>}],"compress":0}

Response

Copied!
<?xml version="1.0" encoding="utf-8"?>

<kml>
	<Document>
		<name>
			export_zones_result
		</name>
	</Document>
</kml>

If the request is not completed, an error code is returned.

Error codes

CodeDescription
1Invalid or obsolete request SID.
4

One of the following errors:

  • parameter validation error,
  • empty array of geofences in the request,
  • failed to create a directory for temporary results.
6

One of the following errors:

  • failed to fetch the current user,
  • error processing XML,
  • error compressing the file.
Download PDF file
Download Word document

See also