load_interval

To load messages for a certain interval, use the messages/load_interval method.

Endpoint

Copied!
svc=messages/load_interval&params={
  "itemId": <long>,
  "timeFrom": <uint>,
  "timeTo": <uint>,
  "flags": <uint>,
  "flagsMask": <uint>,
  "loadCount": <uint>,
  "calcSensors": <uint>,
  "measure": <uint>,
  "sensorId": <long>,
  "filter": "<text>"
}

Parameters

The required parameters are marked with an asterisk (*).

Parameter Description
itemId* Unit or resource ID (depends on the type of message you want to get).
timeFrom* Interval beginning.
timeTo* Interval end. If timeFrom is greater than timeTo, no messages are returned and count is 0.
flags* Flags for loading messages. See the description below.
flagsMask* Mask. See the description below.
loadCount* Number of messages to return, starting from the beginning of the interval (that is, the oldest messages are returned first). 0xffffffff means all the found ones. If 0 is specified, the messages array is empty.
calcSensors Calculation of sensor values. If the value is anything other than 0, each message in the response contains the sensors object with the values of the unit sensors. The keys of this object are sensor IDs. In Wialon Local, this parameter is available starting from version 2604.
measure Measurement system for sensor values: 0 for metric (SI), 1 for US, 2 for imperial, 3 for metric with gallons. Used only with calcSensors. If the parameter isn’t specified, the value set for the current session is used (the two lowest bits of the flags parameter of render/set_locale). In Wialon Local, this parameter is available starting from version 2604.
sensorId Sensor ID. Used only with calcSensors. If specified, the sensors object contains the value of this sensor only. If the parameter isn’t specified or is 0, the values of all sensors are calculated. In Wialon Local, this parameter is available starting from version 2604.
filter Filter for the pos and p parameters of messages: a comma-separated list of masks, for example, pos.x,p.pre*. Only the matching parameters are returned. For details, see messages/get_messages.

Examples of using masks and flags

Mask Flag Result
0xFF00 0x0000 All data messages.
0xFF10 0x0010 Data messages which contain the alarm bit (0x10).
0xFFF0 0x0010 Data messages which contain the alarm bit (0x10), but don’t contain information about the driver code (0x20).
0xFFF2 0x0022 Data messages which contain information about the driver code (0x20) and input data information (0x02), but don’t contain the alarm bit (0x10).
0xFF01 0x0601 Events regarded as violations.
0xFF00 0x4000 Messages about triggered notifications.
0xFF00 0x5000 Tasks. For details, see Task.

Response

If the request is completed successfully, the response is as follows:

Copied!
{
  "count": <uint>,  /* number of messages found for the interval; doesn't depend on loadCount */
  "messages": [     /* array of messages */
    {
      ...
    }
  ]
}

For message formats, masks, and flags, see Messages.

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

Error codes

Error code Description
4 Wrong input parameters: a required parameter is missing or has a wrong type (for example, timeFrom is negative).
6 Internal error: failed to get messages for the interval or the session data required to format them.
7 The item doesn’t exist or doesn’t store messages, or the user has no Request reports and messages access right to it.
1003 The Accept-Encoding request header doesn’t contain gzip.
1004 The limit of loaded messages is reached (LIMIT msgs_count). See Error codes. In Wialon Local, this error is returned starting from version 2604.

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