export_messages

To export messages (loaded to a layer or directly) to a file, use the exchange/export_messages method.

Endpoint

Copied!
svc=exchange/export_messages&params={
  "layerName": <text>,
  "format": <text>,
  "itemId": <long>,
  "timeFrom": <uint>,
  "timeTo": <uint>,
  "compress": <bool>
}

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:
  • error validating parameters,
  • layer not found,
  • failed to save messages to the temporary file.
6 One of the following errors:
  • failed to fetch the user,
  • failed to fetch the renderer,
  • compression-related problems.
7 One of the following errors:
  • unit not found,
  • the user doesn’t have the required access right to the unit: Request reports and messages for the first mode, Export messages for the second mode.
1001 The unit has no messages within the specified time interval, or any messages at all.

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