Counters
This resource contains counter specific actions
Find information on how to get counters data here.
Resource specific actions
Actions with counter entities:
Actions with counter values:
read
Reads counter of passed type.
Parameters
tracker_id
ID of the tracker (aka "object_id"). Tracker must belong to authorized user and not be blocked.
int
123456
Examples
Response
Errors
204 - Entity not found – if there is no tracker with such ID belonging to authorized user.
208 - Device blocked – if tracker exists but was blocked due to tariff restrictions or some other reason.
219 - Not allowed for clones of the device – if specified tracker is a clone.
update
Updates counter of passed type.
required sub-user rights: tracker_update.
Parameters
tracker_id
ID of the tracker (aka "object_id"). Tracker must belong to authorized user and not be blocked.
int
123456
multiplier
A new value of counter multiplier.
float
1.34
sensor_id
ID of the sensor, which must be used as the source of odometer data (in case when parameter "type" equals "odometer"). If "type" is not "odometer", "sensor_id" must be null.
int
123
Examples
Response
Errors
8 - Queue service error, try again later – cannot set counter value, try later.
204 - Entity not found – if there is no tracker with such ID belonging to authorized user.
208 - Device blocked – if tracker exists but was blocked due to tariff restrictions, or some other reason.
219 - Not allowed for clones of the device – if specified tracker is a clone.
7 - Invalid parameters –
if type is not "odometer" and
sensor_idis not null.if sensor with specified
sensor_idis not a metering sensor.if sensor with specified
sensor_idbelongs to another tracker.if
sensor_idis negative.if sensor with such a
sensor_idis not exists.if type value is not one of list above.
get_counters
Gets last values of the tracker's counters.
Parameters
tracker_id
Tracker ID (aka "object_id").
int
999119
Examples
Response
user_time- date/time. Current time in user's timezone.list- array of counter value objects.type- enum. One of predefined semantic counter types (see below).value- double. Counter value.update_time- date/time. Date and time when the data updated.
List of counter types:
odometer- odometer.engine_hours- engine hours.
Errors
204 – Entity not found - if there is no tracker with such ID belonging to authorized user.
208 – Device blocked - if tracker exists but was blocked due to tariff restrictions or some other reason.
value/get
Gets actual value of specified type of sensor.
Parameters
tracker_id
ID of the tracker (aka "object_id"). Tracker must belong to authorized user and not be blocked.
int
123456
Examples
Response
value- float. The last valuer of counter.
Errors
204 - Entity not found – if there is no tracker with such ID belonging to authorized user, counter does not exist or there are no values yet. use /tracker/counter/set to create new counter (if not exist) and save some value.
208 - Device blocked – if tracker exists but was blocked due to tariff restrictions or some other reason.
value/list
Get actual values for counters of passed type and trackers.
Parameters
trackers
List of the tracker's ID belonging to authorized user.
int array
[123456, 234567]
Example
cURL
Response
value- a map with tracker's IDs as keys.
Errors
204 - Entity not found – if one of the specified counter does not exist or there are no values yet. Use
/tracker/counter/setto create new counter (if not exist) and save some value.217 - List contains nonexistent entities – if one of the specified trackers does not exist or is blocked.
value/set
Creates new counter of passed type (if not) and update its value.
Parameters
tracker_id
ID of the tracker (aka "object_id"). Tracker must belong to authorized user and not be blocked.
int
123456
value
A new value of counter.
float
233.21
Example
cURL
Response
Errors
8 - Queue service error, try again later - can't set counter value, try later.
204 - Entity not found – if there is no tracker with such ID belonging to authorized user.
208 - Device blocked – if tracker exists but was blocked due to tariff restrictions or some other reason.
219 - Not allowed for clones of the device – if specified tracker is a clone.
data/read
Returns counter values for a period.
Parameters
tracker_id
Tracker ID (aka "object_id").
int
123456
from
Requested period start.
date/time
"2021-02-25 12:21:17"
to
Requested period end.
date/time
"2021-03-25 12:21:17"
Example
cURL
Response
Errors
204 - Entity not found – if there is no tracker or counter belonging to authorized user.
211 - Requested time span is too big – if interval between "from" and "to" is too big (maximum value specified in API config)
208 - Device blocked – if tracker exists but was blocked due to tariff restrictions or some other reason.
7 - Invalid parameters –
if
fromis afterto;if between
fromandtomore than 31 days.
Last updated
Was this helpful?