export_messages
To export messages (loaded to a layer or directly) to a file, use the exchange/export_messages method.
Endpoint
svc=exchange/export_messages¶ms={
"layerName": <text>,
"format": <text>,
"itemId": <long>,
"timeFrom": <uint>,
"timeTo": <uint>,
"compress": <bool>
}
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
The required parameters are marked with an asterisk (*).
| Parameter | Description |
|---|---|
layerName |
Message layer name. Specify it to export messages from a layer. |
itemId |
Unit identifier in the system. Specify it to export messages directly. |
format* |
File format: txt, kml, plt, wln, or wlb. |
timeFrom |
Start of the interval. Specify it to export messages directly. |
timeTo |
End of the interval. Specify it to export messages directly. |
compress* |
Specify 1 to compress the file, or 0 to get the uncompressed file. |
Response
Returns a file of the specified format.
If the request parameters have the itemId, timeFrom, timeTo, format, and compress fields, the unit is obtained by the value of the itemId field and then the unit messages from timeFrom to timeTo are returned. The layerName field is ignored in this case, even if it is specified in the request. Otherwise (if at least one of the itemId, timeFrom, timeTo, format, and compress fields is missing), the layer is obtained by the value of the layerName field; after that, the unit is obtained from the layer and all the unit messages are returned (in this case the timeFrom and timeTo fields are ignored). In other words, the method operates in two modes. The first one requires the itemId, timeFrom, timeTo, format, and compress fields; the second one requires the layerName, format, and compress fields.
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 1 | Invalid or obsolete request SID. |
| 4 | One of the following errors:
|
| 6 | One of the following errors:
|
| 7 | One of the following errors:
|
| 1001 | The unit has no messages within the specified time interval, or any messages at all. |