Start requesting data
Now that you have connected your devices up the PathStack, it’s time to start using it! There are many different types of data you can request, but we’ll focus on the 3 main types in this guide: Devices, Trips, and Positions.
Devices
Devices are any telematics devices that you have connected through the PathStack portal. They can be anything for Truck GPS trackers to shipping trackers or boat beacons.
Devices are likely to be the first resource that you would like to request. By requesting devices, you can then get a list of devices that you have access to, and can use the IDs of these devices to request more refined data such as trips.
To get a list of devices, Authenticate and make a call to the /device
endpoint. This will return a list of devices that you have connected. Optionally, you can filter by the telematics
provider.
This will return a response that looks something like this:
Each element in the list is a device, and there are attributes such as make and model. An important attribute is id
,
which you can use to get the trips for a particular device, which you will see in the next section.
Trips
A trip represents a journey that a device has taken from start to finish, and consist of many positions. A trip has a start and end position and time.
Not all telematics providers have trip information. For cases where there is no trip information given, PathStack will use algorithms to estimate trips within the positions received.
Once you have the list of devices, you can fetch the trips for a device by making a call to /device/{device_id}/trip
endpoint. You can filter trips by start time and end time by passing start_time_utc
and end_time_utc
.
This will return a response that looks something like this:
Each element in the list is a trip which the device has taken, and there are additional attributes such as trip duration.
An important attribute is id
, which is the unique ID of the trip. This id can be used to request the positions for a
trip, as you will see in the next section.
Positions
A position is a single point in time with a latitude and longitude. Positions are the building blocks of trips, and a trip may have hundreds or even thousands of positions.
Once you have a list of trips, if you want you can request the positions for each trip, using the
/trip/{trip_id}/position
endpoint.
This will return a response that looks something like this:
The Devices, Trips, Positions and Events endpoints are all paginated. You can find out more here.