Events
curl --request GET \
--url https://api.pathstack.io/device/{device_id}/event \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pathstack.io/device/{device_id}/event"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pathstack.io/device/{device_id}/event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathstack.io/device/{device_id}/event",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pathstack.io/device/{device_id}/event"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pathstack.io/device/{device_id}/event")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathstack.io/device/{device_id}/event")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"event_key": "ignition_status",
"time": "2023-11-07T05:31:56Z",
"raw_data": {},
"value": {
"harsh_braking": true
},
"position": {
"latitude": 0,
"longitude": 0
},
"id": "<string>",
"device_id": "<string>",
"trip_id": "<string>"
}
],
"links": {
"previous": "<string>",
"current": "<string>",
"next": "<string>"
}
}{
"error": {
"code": 400,
"message": "Invalid JWT format"
}
}{
"error": {
"code": 401,
"message": "Authentication header is missing, or token is invalid/expired."
}
}{
"error": {
"code": 403,
"message": "You do not have access to this resource"
}
}{
"error": {
"code": 404,
"message": "Device with ID <device_id> not found"
}
}{
"error": {
"code": 422,
"message": "Field required",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
}Events
Events
This endpoint returns the Events for a Device.
You can optionally specify parameters for event_type, start_time_utc and end_time_utc to filter the results.
The response is paginated, so if the next link is not null, use that link to get the next page of results.
GET
/
device
/
{device_id}
/
event
Events
curl --request GET \
--url https://api.pathstack.io/device/{device_id}/event \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pathstack.io/device/{device_id}/event"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pathstack.io/device/{device_id}/event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathstack.io/device/{device_id}/event",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pathstack.io/device/{device_id}/event"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pathstack.io/device/{device_id}/event")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathstack.io/device/{device_id}/event")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"event_key": "ignition_status",
"time": "2023-11-07T05:31:56Z",
"raw_data": {},
"value": {
"harsh_braking": true
},
"position": {
"latitude": 0,
"longitude": 0
},
"id": "<string>",
"device_id": "<string>",
"trip_id": "<string>"
}
],
"links": {
"previous": "<string>",
"current": "<string>",
"next": "<string>"
}
}{
"error": {
"code": 400,
"message": "Invalid JWT format"
}
}{
"error": {
"code": 401,
"message": "Authentication header is missing, or token is invalid/expired."
}
}{
"error": {
"code": 403,
"message": "You do not have access to this resource"
}
}{
"error": {
"code": 404,
"message": "Device with ID <device_id> not found"
}
}{
"error": {
"code": 422,
"message": "Field required",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Path Parameters
Device ID of the Events to be returned
Query Parameters
Start time from when the data will be returned
End time from when the data will be returned
Only include events of this type
Available options:
ignition_status, idling, odometer, harsh_braking, harsh_acceleration, hard_cornering, engine_speed, accident, total_fuel, over_speeding, power_take_off_engaged, auxiliary_equipment_operation, gps_signal_blocked, adas_distance_maintenance, adas_forward_collision, adas_lane_departure, adas_pedestrian_collision, dms_distraction, dms_eyes_closed, dms_no_driver, dms_phone_calling, dms_smoking, dms_yawn Verify data collection status, If true, checks data collection jobs for the time period and fails with a 424 status if any jobs have failed or are still running.
Page number for pagination (zero-indexed)
Required range:
x >= 0
