load
To load events for a specified period into the session for later processing, use the events/load method.
After loading, retrieve the events using the events/get method.
Endpoint
svc=events/load¶ms={"itemId":<long>,
"ivalType":<int>,
"timeFrom":<uint>,
"timeTo":<uint>,
"detectors":[
{
"type":<text>,
"filter1":<long>
},
...
]}
Parameters
| Parameter | Description |
|---|---|
itemId |
Unit ID. |
ivalType |
Time interval selection method (see below). |
timeFrom |
Depends on ivalType:
|
timeTo |
Interval end (UNIX time). |
type |
Event detector, for example: lls, filling, theft, fuel_level, battery_level, charge, sensors, ignition, trips, counters, speedings, health_check, or eco_driving. See more. |
filter1 |
Detector filter. For sensor-based detectors, use a sensor ID; use 0 to load all sensors of the selected type. For eco_driving, use 0 to load all criteria; a value other than 0 filters by criterion type. |
measure |
Measurement system:
The default value is 0. |
lang |
Language (2-character code). The default value is en. |
The
eco_drivingevent detector isn’t available in Wialon Local.
To load events for a different period, first unload the current events using events/unload, then call events/load again.
Interval selection method (ivalType)
| Value | Description |
|---|---|
1 |
Loads messages (events) from timeFrom to timeTo. |
2 |
Loads the number of messages specified in timeFrom, starting from timeTo. |
3 |
Loads the number of messages specified in timeFrom, up to timeTo. |
4 |
Loads messages from timeFrom to timeTo, plus one message before timeFrom. |
5 |
Loads messages from timeFrom to timeTo, plus one message after timeTo. |
6 |
Loads messages from timeFrom to timeTo, plus one message before timeFrom and one after timeTo. |
Response
If the request is completed successfully, the response contains the number of loaded events for each detector requested in detectors and each detector-specific ID. The states object contains the update time for each loaded detector. The selector object is reserved for selection results.
{
"events": {
"<detector_type>": {
"<detector_specific_id>": <uint> /* number of loaded events */
}
},
"states": {
"<detector_type>": {
"updateTime": <uint> /* update time, UNIX time */
}
},
"selector": { ... }
}
If the request is not completed, an error code is returned.
Error codes
| Code | Description |
|---|---|
| 1 | Invalid or obsolete request SID. |
| 4 | Parameter validation error. |
| 5 | Events are disabled or initializing. |
| 6 | Failed to load events. |
| 7 | The event service is unavailable, or the required access rights are missing. |