WiseTrace API Reference
This website documents the public API for WiseTrace data extraction
You can view code examples in the dark area to the right; switch the programming language of the examples with the tabs in the top right.
Authentication
The authentication system is based on oAuth2 (Open Auth).
WiseTrace API is JSON based.
In order to make an authenticated call to the API, you must include your access token with the call. OAuth2 uses a BEARER token that is passed along in an Authorization header. Once the provider send you back a token, just pass it to every secured endpoint using the following header:
Authorization
Request Access Token
{
"token_type": "Bearer",
"expires_in": 31536000,
"access_token": "your-access-token",
"refresh_token": "your-refresh-token"
}
# Get Token:
curl --location --request POST 'https://api.wisetrace.es/oauth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"client_id": 9,
"client_secret": "24bgU6CCuNtpHkf4D6wRQQU47a2uZBN2",
"grant_type": "password",
"username": "api-user@wisetrace.es",
"password": "userpassword"
}'
The access token is a unique key used to make requests to the API.
This endpoint retrieves your auth token and your refresh token to allow use this service.
HTTP Request
POST https://api.wisetrace.es/oauth/token
In order to get an access token, the application must make a POST request to https://api.wisetrace.es/oauth/token
with the grand_type
, client_id
, client_secret
, username
and password
as parameters.
Body Parameters (As JSON format)
Parameter | Type <Format> | Required | Description |
---|---|---|---|
username | string | true | Your Email |
password | string | true | Your Password |
client_id | string | true | The application's client ID provided by WiseTrace |
client_secret | string | true | The application's client secret provided by WiseTrace |
grant_type | string | true | Authorization grant will be "password" |
Response codes
Error Code | HTTP Code | Description |
---|---|---|
n/a | 200 | Successful operation |
invalid_request | 400 | The request is malformed, a required parameter is missing or a parameter has an invalid value. |
invalid_client | 401 | Client authentication failed. |
invalid_credentials | 401 | The user credentials were incorrect. |
invalid_grant | 400 | Invalid authorization grant, grant invalid, grant expired, or grant revoked. |
unauthorized_client | 400 | Client is not authorized to use the grant. |
unsupported_grant_type | 400 | Authorization grant is not supported by the Authorization Server. |
Devices
Fetch Single
Code samples
{
"data": {
"id": 1,
"label": "gps00001A",
"info": {
"iccid": "800000000000000088F",
"matricula": "V1001ABZ"
},
"sensors": [
{
"name": "location",
"capture_time": "2021-06-28 09:57:25",
"value": {
"lat": 39.4687083,
"long": -0.3711066,
"timestamp": 1624874245
},
"events": null
}
]
}
}
# You can also use wget
curl -X GET /data-api/v1/device/{deviceId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/device/{deviceId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/device/{deviceId}', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/device/{deviceId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/device/{deviceId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
This endpoint retrieves info about a device.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/device/{deviceId}
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deviceId | path | integer(int64) | true | ID of device to return |
fields | query | string | false | Adds device sensors last values to response |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Device Resource
Resource
{
"data": {
"id": 941,
"label": "tkstar_SMB_01",
"info": {
"iccid": "800000000000000088F",
"matricula": "V12012ABC"
},
"sensors": [
{
"name": "location",
"capture_time": "2021-06-28 09:57:25",
"value": {
"lat": 39.4687083,
"long": -0.3711066,
"timestamp": 1624874245
},
"events": [
{
"type": 4,
"state": 1,
"description": null
}
]
},
{
"name": "battery",
"capture_time": "2021-06-28 09:57:25",
"value": {
"value": 10
},
"events": [
{
"type": 1,
"state": 1,
"description": null
}
]
},
{
"name": "speed",
"capture_time": "2021-06-28 09:57:25",
"value": {
"value": 20
},
"event": null
}
]
}
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | true | none | Internal ID |
label | string | true | none | Label |
info | object | false | none | dictionary of device info properties |
sensors | object | false | none | dictionary of device sensors properties |
Fetch All
Code samples
{
"data": [
{
"id": 1,
"label": "gps00001A",
"info": {
"iccid": "800000000000000088F",
"matricula": "V1001ABZ"
},
"sensors": [
{
"name": "location",
"capture_time": "2021-06-28 09:57:25",
"value": {
"lat": 39.4687083,
"long": -0.3711066,
"timestamp": 1624874245
},
"events": null
}
]
},
{
"id": 2,
"label": "00000001",
"info": {
"vehicle_type": "garbage_truck",
"device-model": "model-FMB"
},
"sensors": {
"name": "level_percent",
"capture_time": "2021-01-01 00:00:01",
"value": "50",
"events": null
}
},
{
"id": 3,
"label": "00000002",
"info": {
"vehicle_type": "garbage_truck",
"device-model": "model-FMB"
}
}
],
"links": {
"first": "https://api.wisetrace.es/data-api/v1/devices?per-page=10&page=1",
"last": "https://api.wisetrace.es/data-api/v1/devices?per-page=10&page=1000",
"prev": "https://api.wisetrace.es/data-api/v1/devices?per-page=10&page=1",
"next": "https://api.wisetrace.es/data-api/v1/devices?per-page=10&page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1000,
"path": "https://api.wisetrace.es/data-api/v1/devices",
"per_page": "10",
"to": 100,
"total": 10000
}
}
# You can also use wget
curl -X GET /data-api/v1/devices \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/devices',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/devices', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/devices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/devices', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
This endpoints retrieves a list of devices IDs and the additional info requested.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/devices
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
fields | query | string | false | Adds device sensors to response. Only 'sensors' keyword |
type | query | string | false | Type of the device |
info.vehicle_type | query | string | false | See Info for values. Filter vehicle_type info key |
info.type | query | string | false | See Info for values. Filter into additional type info key |
info.distance_traveled_initial_value | query | integer(int64) | false | Filter into info keys and values |
info.distance_traveled_last_value | query | integer(int64) | false | Filter into info keys and values |
info.iccid | query | string | false | Filter into info keys and values |
info.matricula | query | string | false | Filter into info keys and values |
info.status_battery | query | integer(int64) | false | Filter into info keys and values |
per-page | query | integer(int64) | false | Maximum number of items displayed per page |
page | query | integer(int64) | false | Number of page to display |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
Events
Types
Code samples
{
"data": [
{
"id": 1,
"description": "Battery low (less than 20%)"
},
{
"id": 2,
"description": "Engine started"
},
{
"id": 3,
"description": "Engine stopped"
}
]
}
# You can also use wget
curl -X GET /data-api/v1/event/types \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/event/types',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/event/types', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/event/types");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/event/types', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
This endpoints retrieves a list of event types IDs and their description.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/event/types
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
Event Resource
Resource
{
"id": 1,
"description": "Temperatura máxima alcanzada"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | true | none | none |
description | string | true | none | none |
Device Events
Code samples
{
"current_page": 1,
"data": [
{
"captureTime": "2020-03-23 10:42:23",
"sensors": [
{
"name": "compartimento_delantero",
"capture_time": "2020-03-23 10:42:23",
"value": {
"soplado": 12.8,
"retorno": 12.7,
"consigna": -25,
"equipo": true
},
"events": [
{
"type": 6,
"state": 0,
"description": {
"id": 46892,
"level_percent": 75,
"com_device": 9211
}
},
{
"type": 3,
"state": 0,
"description": null
}
]
}
]
}
],
"first_page_url": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/events?from-date={dateFrom}&to-date={dateTo}&page=1",
"from": 1,
"next_page_url": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/events?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=2",
"path": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/events",
"per_page": 10,
"prev_page_url": null,
"to": 10
}
# You can also use wget
curl -X GET /data-api/v1/device/{deviceId}/events \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/device/{deviceId}/events',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/device/{deviceId}/events', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/device/{deviceId}/events");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/device/{deviceId}/events', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Fetch events by deviceId grouped by date.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/device/{deviceId}/events
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deviceId | path | integer(int64) | true | ID of device to return |
from-date | query | string | false | The beginning of the date bounds to be returned paginated |
to-date | query | string | false | The latest of the date bounds to be returned paginated |
per-page | query | integer(int64) | false | Maximum number of items displayed per page |
page | query | integer(int64) | false | Number of page to display |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Event Log Resource
Resource
{
"type": 5,
"state": 1,
"description": {
"field": 1,
"id": 1234,
"label": "WTC000001",
"level_percent": 25
}
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
type | integer | false | none | related to EventType (check the EventTypes available) |
state | integer | false | none | customer domain state value |
description | object | false | none | description values related to the event |
Sensors
Fetch Last Data
Code samples
{
"data": [
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1":0,
"digital_input_2":0,
"digital_input_3":0,
"digital_input_4":0,
"movement":1,
"ignition":1,
"external_voltage":26.206,
"door_status":16,
"program_number":12135,
"module_id":-2857196311489744188,
"security_state_flags":-2630102182383321087
},
"events": [
{
"type": 5,
"state": 1,
"description": null
},
{
"type": 6,
"state": 1,
"description": {
"id": 46892,
"level_percent": 50,
"com_device": 9211
}
}
]
}
]
}
# You can also use wget
curl -X GET /data-api/v1/device/{deviceId}/sensors \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/device/{deviceId}/sensors',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/device/{deviceId}/sensors', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/device/{deviceId}/sensors");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/device/{deviceId}/sensors', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Fetch last data available of a Device Sensors.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensors
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deviceId | path | integer(int64) | true | ID of device containing sensors to return |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Sensor Resource
Resource
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1":0,
"digital_input_2":0,
"digital_input_3":0,
"digital_input_4":0,
"movement":1,
"ignition":1,
"external_voltage":26.206,
"door_status":16,
"program_number":12135,
"module_id":-2857196311489744188,
"security_state_flags":-2630102182383321087
}
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | SensorName | false | none | Sensor friendly name |
captureTime | string | false | none | Data's capture time |
value | object | false | none | Object of values |
event | EventResource | false | none | Event related to this sensor, can be null if no event exists |
Fetch Last Data by SensorName
Code samples
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1":0,
"digital_input_2":0,
"digital_input_3":0,
"digital_input_4":0,
"movement":1,
"ignition":1,
"external_voltage":26.206,
"door_status":16,
"program_number":12135,
"module_id":-2857196311489744188,
"security_state_flags":-2630102182383321087
},
"events": [
{
"type": 5,
"state": 1,
"description": null
}
]
}
# You can also use wget
curl -X GET /data-api/v1/device/{deviceId}/sensor/{sensorName} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/device/{deviceId}/sensor/{sensorName}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/device/{deviceId}/sensor/{sensorName}', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/device/{deviceId}/sensor/{sensorName}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/device/{deviceId}/sensor/{sensorName}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Fetch last data available of a Device Sensors filtering by sensorName
.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensor/{sensorName}
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deviceId | path | integer(int64) | true | ID of device to return |
sensorName | path | string | true | Name of the sensor. See SensorName for values available |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Fetch Device Data Logs by Date
Code samples
{
"current_page": 1,
"data": [
{
"captureTime": "2020-03-23 10:42:23",
"sensors": [
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1":0,
"digital_input_2":0,
"digital_input_3":0,
"digital_input_4":0,
"movement":1,
"ignition":1,
"external_voltage":26.206,
"door_status":16,
"program_number":12135,
"module_id":-2857196311489744188,
"security_state_flags":-2630102182383321087
},
"events": [
{
"type": 5,
"state": 1,
"description": null
}
]
}
]
}
],
"first_page_url": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensors/log?from-date={dateFrom}&to-date={dateTo}&page=1",
"from": 1,
"next_page_url": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensors/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=2",
"path": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensors/log",
"per_page": 10,
"prev_page_url": null,
"to": 10
}
# You can also use wget
curl -X GET /data-api/v1/device/{deviceId}/sensors/log \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/device/{deviceId}/sensors/log',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/device/{deviceId}/sensors/log', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/device/{deviceId}/sensors/log");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/device/{deviceId}/sensors/log', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Fetch Device Sensors Data Logs grouping by date.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensors/log
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deviceId | path | integer(int64) | true | ID of device to return |
from-date | query | string(date) | false | Starting datetime to filter the query. By default is the current day at 00:00:00 |
to-date | query | string(date) | false | Ending datetime to filter the query. By default is the current day at 23:59:59 |
per-page | query | integer(int64) | false | Maximum number of items displayed per page |
page | query | integer(int64) | false | Number of page to display |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Fetch Device Data Logs by Name
Code samples
{
"data": [
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1":0,
"digital_input_2":0,
"digital_input_3":0,
"digital_input_4":0,
"movement":1,
"ignition":1,
"external_voltage":26.206,
"door_status":16,
"program_number":12135,
"module_id":-2857196311489744188,
"security_state_flags":-2630102182383321087
},
"events": [
{
"type": 5,
"state": 1,
"description": null
}
]
}
],
"links": {
"first": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensor/{sensorName}/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=1",
"last": null,
"prev": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensor/{sensorName}/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=1",
"next": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensor/{sensorName}/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=3"
},
"meta": {
"current_page": 2,
"from": 11,
"path": "https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensor/{sensorName}/log",
"per_page": 10,
"to": 20
}
}
# You can also use wget
curl -X GET /data-api/v1/device/{deviceId}/sensor/{sensorName}/log \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/device/{deviceId}/sensor/{sensorName}/log',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/device/{deviceId}/sensor/{sensorName}/log', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/device/{deviceId}/sensor/{sensorName}/log");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/device/{deviceId}/sensor/{sensorName}/log', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Fetch Device Sensors Data Logs filtering by sensorName
.
HTTP Request
GET https://api.wisetrace.es/data-api/v1/device/{deviceId}/sensor/{sensorName}/log
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deviceId | path | integer(int64) | true | ID of device containing sensor |
sensorName | path | string | true | Name of the sensor. See SensorName for values available |
from-date | query | string(date) | false | Starting datetime to filter the query. By default is the current day at 00:00:00 |
to-date | query | string(date) | false | Ending datetime to filter the query. By default is the current day at 23:59:59 |
per-page | query | integer(int64) | false | Maximum number of items displayed per page |
page | query | integer(int64) | false | Number of page to display |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Fetch comDevice reader
Code samples
{
"data": [
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1": 0,
"digital_input_2": 0,
"digital_input_3": 1,
"digital_input_4": 0,
"movement": 1,
"ignition": 1,
"external_voltage": 26.206,
"door_status": 16,
"program_number": 12135,
"module_id": -2857196311489744188,
"security_state_flags": -2630102182383321087
},
"events": [
{
"type": 5,
"state": 1,
"description": null
},
{
"type": 6,
"state": 1,
"description": {
"id": 46892,
"label": "WTC00046892",
"level_percent": 50,
"com_device": 9211
}
}
],
"device": {
"id": 9999,
"label": "35801FC26",
"info": {
"iccid": "41432535353"
}
}
}
],
"links": {
"first": "https://api.wisetrace.es/data-api/v1/sensor/{sensorName}/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=1",
"last": null,
"prev": "https://api.wisetrace.es/data-api/v1/sensor/{sensorName}/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=1",
"next": "https://api.wisetrace.es/data-api/v1/sensor/{sensorName}/log?from-date={dateFrom}&to-date={dateTo}&per-page=10&page=3"
},
"meta": {
"current_page": 2,
"from": 11,
"path": "https://api.wisetrace.es/data-api/v1/sensor/{sensorName}/log",
"per_page": 10,
"to": 20
}
}
# You can also use wget
curl -X GET /data-api/v1/sensor/{sensorName}/log \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/data-api/v1/sensor/{sensorName}/log',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('/data-api/v1/sensor/{sensorName}/log', headers = headers)
print(r.json())
URL obj = new URL("/data-api/v1/sensor/{sensorName}/log");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/data-api/v1/sensor/{sensorName}/log', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Fetch all Data Logs given a sensorName
with the reader device (com_device
) and the rfid tag (container) read
HTTP Request
GET https://api.wisetrace.es/data-api/v1/sensor/{sensorName}/log
Query Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
sensorName | path | string | true | Name of the sensor. See SensorName for values available |
value.com_device | query | string | false | value.{valueName}=filter value by given name |
fields | query | string | false | adds device info and sensors to sensor log response (only 'device' and 'sensors' keywords) |
from-date | query | string(date) | false | Starting datetime to filter the query. By default is the current day at 00:00:00 |
to-date | query | string(date) | false | Ending datetime to filter the query. By default is the current day at 23:59:59 |
per-page | query | integer(int64) | false | Maximum number of items displayed per page |
page | query | integer(int64) | false | Number of page to display |
Response codes
HTTP Code | Description |
---|---|
200 | Successful operation |
404 | Device Not Found |
Dictionary
Device_type
Check here the available keys to use and retrieve from our data. Contact our support in order to get which ones applies to your scope project.
Query Parameters
Name | In | Type | Description |
---|---|---|---|
type | query | string | Device type. See values below |
Type Values
Name | In | Type | Description |
---|---|---|---|
obd | query | string | Vehicle parameter reader |
tkstar | query | string | GPS device |
tag_rfid | query | string | RFID Tag |
gateway | query | string | Antenna |
beacon | query | string | Reader |
asset | query | string | Asset |
Device_info
Resource
{
"info": {
"matricula" : "RJ12345",
"iccid": "00053134181912012141",
"vehicle_type": "garbage_truck",
"device-model": "model-FMB",
"type": "container",
"distance_traveled_initial_value": 0,
"distance_traveled_last_value": 0,
"status_battery": 1
}
}
Check here the available keys to use and retrieve from our data. Contact our support in order to get which ones applies to your scope project.
Query Parameters
Name | In | Type | Description |
---|---|---|---|
matricula | query | string | Vehicle plate number |
iccid | query | string | ICCID/IMEI serial number |
vehicle_type | query | string | Vehicle type name. See values below |
device-model | query | string | Device Model. See values below |
type | query | string | Device common name. See values below |
distance_traveled_initial_value | query | integer(int64) | Distance traveled initial value |
distance_traveled_last_value | query | integer(int64) | Distance traveled last value |
status_battery | query | integer(int64) | Status battery |
Vehicle_type Values
Name | In | Type | Description |
---|---|---|---|
sweeper | query | string | Sweeper Cleaner |
garbage_truck | query | string | Garbage truck vehicle |
Type Values
Name | In | Type | Description |
---|---|---|---|
container | query | string | RFID Tag attached to a container |
Device-model Values
Name | In | Type |
---|---|---|
FMB001 | query | string |
FMB125 | query | string |
FMB640 | query | string |
SensorName
Resource
{
{
"name": "location",
"capture_time": "2020-03-23 10:42:23",
"value": {
"lat": 39.598716735839844,
"long": -0.550411581993103,
"timestamp": 1618575920
}
},
{
"name": "speed",
"capture_time": "2020-03-23 10:42:23",
"value": {
"value": 0
}
},
{
"name": "other_parameters",
"capture_time": "2020-03-23 10:42:23",
"value": {
"digital_input_1":0,
"digital_input_2":0,
"digital_input_3":0,
"digital_input_4":0,
"movement":1,
"ignition":1,
"external_voltage":26.206,
"door_status":16,
"program_number":12135,
"module_id":-2857196311489744188,
"security_state_flags":-2630102182383321087
}
},
{
"name": "battery",
"capture_time": "2020-03-23 10:42:23",
"value": {
"value": 90
}
}
}
Check here the available keys to use and retrieve from our data. Contact our support in order to get which ones applies to your scope project.
Query Parameters
Name | In | Type | Description |
---|---|---|---|
sensorName | path | string | Sensor name |
Name Values
Name | In | Type | Description |
---|---|---|---|
location | path | string | GPS coordinates (lat & long) |
other_parameters | path | string | ODB related vehicle parameters |
speed | path | string | Speed value |
level_percent | path | string | Percent level of a container fill |
battery | path | string | Battery value |
ble_baterias | path | string | Ble Batteries value |
comp_front_low | path | string | Truck Front compartment |
comp_back_low | path | string | Truck Back compartment |
distance_traveled_since_codes_clear | path | string | Distance traveled since codes were cleared |
SensorEvents
Resource
{
"events": [
{
"type": 1,
"state": 0,
"description": null
},
{
"type": 2,
"state": 0,
"description": {
"timestamp": 1634724506,
"rpm": 40
}
},
{
"type": 6,
"state": 0,
"description": {
"id": 127,
"label": "WTC0000127",
"level_percent": 0,
"com_device": 17850
}
},
]
}
Check here the available keys to use and retrieve from our data. Contact our support in order to get which ones applies to your scope project. Check Event Types also for more info about types.
Description Values
Description field may provide additional info about related event. These information may be provided only to certain events. Contact our support in order to get which ones applies to your scope project.
Name | Type | Description |
---|---|---|
{key} | string | Value of the field or related info |