Counters
Odometer and engine-hour counters on a tracker, and the values they hold.
A counter accumulates a quantity for a tracker over its lifetime, such as distance travelled or engine running time. Unlike a sensor reading, which reports what is true now, a counter carries a running total that can be corrected when it drifts from the vehicle's own instrument.
Counters split into two things, and the operations follow that split. The counter itself is the entity and its multiplier, read and changed with counter/read and counter/update. Its value is separate, read and set through counter/value. For a worked example, see how to retrieve sensor and counter data.
API actions
Counter entities live under /tracker/counter, and their values under /tracker/counter/value. One call, get_counters, sits at the tracker root instead.
Get one of a tracker's counters, meaning the entity and its multiplier rather than its current value. Use counter/value/get for the value. Available to demo accounts.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456Which counter to act on.
odometerPossible values: The counter
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 204: no tracker with this ID belongs to the account. Error 208: the tracker exists but is blocked, normally because its tariff ended. Error 219: the tracker is a clone.
Error response object
POST /v2/tracker/counter/read HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 39
{
"tracker_id": 123456,
"type": "odometer"
}{
"success": true,
"value": {
"id": 111,
"type": "odometer",
"multiplier": 1
}
}Errors
These errors come in addition to the general error codes:
204 - No tracker with this ID belongs to the account.
208 - The tracker exists but is blocked, normally because its tariff ended.
219 - The tracker is a clone.
Change a counter's multiplier, and for the odometer the sensor it reads from.
sensor_id applies only when type is odometer, and must be null otherwise. The sensor must be a metering sensor belonging to this same tracker; every one of those conditions is reported as error 7.
Requires the tracker_update right.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456Which counter to act on.
odometerPossible values: New multiplier for the counter.
1.34Sensor to use as the odometer source. Must be null unless type is odometer.
123The counter was updated
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 8: the queue service could not accept the change, retry later. Error 204: no tracker with this ID belongs to the account. Error 208: the tracker exists but is blocked, normally because its tariff ended. Error 219: the tracker is a clone.
Error response object
POST /v2/tracker/counter/update HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 73
{
"tracker_id": 123456,
"type": "odometer",
"multiplier": 1.34,
"sensor_id": 123
}{
"success": true
}Errors
These errors come in addition to the general error codes:
7 -
sensor_idwas given for a counter whosetypeis notodometer, or the sensor is not a metering sensor, or it belongs to another tracker.8 - The queue service could not accept the change, retry later.
204 - No tracker with this ID belongs to the account.
208 - The tracker exists but is blocked, normally because its tariff ended.
219 - The tracker is a clone.
Get the last value of every counter on a tracker. Available to demo accounts.
Note the path: this one sits at the tracker root, not under tracker/counter.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456The counter values
true if request finished successfully.
trueCurrent time in the account timezone.
Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 204: no tracker with this ID belongs to the account. Error 208: the tracker exists but is blocked, normally because its tariff ended.
Error response object
POST /v2/tracker/get_counters HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 21
{
"tracker_id": 123456
}{
"success": true,
"user_time": "text",
"list": [
{
"type": "odometer",
"value": 100500.1,
"update_time": "2014-03-06 13:57:00"
}
]
}Errors
These errors come in addition to the general error codes:
204 - No tracker with this ID belongs to the account.
208 - The tracker exists but is blocked, normally because its tariff ended.
Get the current value of one counter. Available to demo accounts.
Error 204 covers three different situations: no such tracker, no such counter, and a counter that exists but has no values yet. Use counter/value/set to create a counter and give it a first value.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456Which counter to act on.
odometerPossible values: The counter value
true if request finished successfully.
trueThe current value.
18.9Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 204: no tracker with this ID belongs to the account. Error 208: the tracker exists but is blocked, normally because its tariff ended.
Error response object
POST /v2/tracker/counter/value/get HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 39
{
"tracker_id": 123456,
"type": "odometer"
}{
"success": true,
"value": 18.9
}Errors
These errors come in addition to the general error codes:
204 - No tracker with this ID belongs to the account.
208 - The tracker exists but is blocked, normally because its tariff ended.
Get the current value of the same counter on many trackers. Available to demo accounts.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
Tracker IDs.
[123456,234567]Which counter to act on.
odometerPossible values: The counter values
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 204: one of the counters does not exist or has no values yet. Error 217: the list names trackers that do not exist or are blocked.
Error response object
POST /v2/tracker/counter/value/list HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 46
{
"trackers": [
123456,
234567
],
"type": "odometer"
}{
"success": true,
"value": {
"ANY_ADDITIONAL_PROPERTY": 1
}
}Errors
These errors come in addition to the general error codes:
204 - One of the counters does not exist or has no values yet.
217 - The list names trackers that do not exist or are blocked.
Set a counter's value, creating the counter if it does not exist yet. This is the call that seeds a counter so value/get stops answering error 204.
Requires the tracker_update right.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456Which counter to act on.
odometerPossible values: New value for the counter.
233.21The value was set
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 8: the queue service could not accept the change, retry later. Error 204: no tracker with this ID belongs to the account. Error 208: the tracker exists but is blocked, normally because its tariff ended. Error 219: the tracker is a clone.
Error response object
POST /v2/tracker/counter/value/set HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 54
{
"tracker_id": 123456,
"type": "odometer",
"value": 233.21
}{
"success": true
}Errors
These errors come in addition to the general error codes:
8 - The queue service could not accept the change, retry later.
204 - No tracker with this ID belongs to the account.
208 - The tracker exists but is blocked, normally because its tariff ended.
219 - The tracker is a clone.
Get a counter's recorded values over a period. Available to demo accounts.
The period cannot exceed 31 days, and from must precede to; both are reported as error 7 rather than as the more general error 211.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456Which counter to act on.
odometerPossible values: Start of the period.
2021-02-25 12:21:17End of the period. At most 31 days after from.
2021-03-25 12:21:17The counter history
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 204: no such tracker or counter. Error 208: the tracker exists but is blocked, normally because its tariff ended. Error 211: the period is longer than the platform allows.
Error response object
POST /v2/tracker/counter/data/read HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 95
{
"tracker_id": 123456,
"type": "odometer",
"from": "2021-02-25 12:21:17",
"to": "2021-03-25 12:21:17"
}{
"success": true,
"list": [
{
"value": 3835.52,
"update_time": "2021-02-01 02:52:55"
}
]
}Errors
These errors come in addition to the general error codes:
7 -
fromis afterto, or the period exceeds 31 days. Reported as error 7 rather than the more general error 211.204 - No such tracker or counter.
208 - The tracker exists but is blocked, normally because its tariff ended.
211 - The period is longer than the Navixy platform allows.
Last updated
Was this helpful?