Skip to main content

GET /api/devices/{deviceId}/lastLocation

This endpoint allows you to retrieve the last known location of a specific device in the satellite tracking application. It is useful for tracking the most recent location of the device and obtaining details about this location.

Request Details

The request is made using the GET method at the /api/devices/{deviceId}/lastLocation URL. You must replace {deviceId} with the actual ID of the device you want to query.

Request Parameters

This endpoint requires the deviceId parameter to be included in the URL path.

ParameterTypeRequiredDescription
deviceIdstringYesThe unique identifier of the device to query.

Authentication Required

Authentication required to use the endpoint is via a Bearer token. This authentication method implies that each request must include an authorization header with a valid access token. This Bearer token acts as a credential that verifies the identity of the user or application making the request, ensuring that only authorized entities can modify the user's information. By requiring this type of authentication, the system guarantees a high level of security and access control, protecting users' data against unauthorized access.

Example Request

GET /api/devices/device123/lastLocation HTTP/1.1
Host: api.plaspy.com
Authorization: Bearer {token}

Response Parameters

The response from this endpoint includes details about the success of the operation and, if successful, information about the last location of the requested device. The response may vary depending on whether the request was successful or if there was an error.

FieldTypeRequiredDescription
successbooleanYesIndicates whether the request was successful.
errorstringNoError message in case the request fails.
apiUsageintegerNoAPI usage in the current request.
apiDailyUsageintegerNoDaily API usage.
lastLocationobjectNoInformation about the last location of the device.

Within the lastLocation field, the object has the following fields:

FieldTypeRequiredDescription
dateTimestringYesDate and time of the last location, in ISO 8601 format.
latitudenumberYesLatitude of the last location.
longitudenumberYesLongitude of the last location.
speednumberNoSpeed at the last location.
coursenumberNoCourse (direction) at the last location.
batteryintegerNoBattery level of the device at the last location.
fuelintegerNoFuel level of the device at the last location.
fuel2integerNoSecondary fuel level at the last location.
temperaturenumberNoTemperature measured at the last location.
temperature2numberNoSecondary temperature measured at the last location.
sensorTime1integerNoSensor 1 time at the last location.
sensorTime2integerNoSensor 2 time at the last location.
sensorTime3integerNoSensor 3 time at the last location.
sensorTime4integerNoSensor 4 time at the last location.
inactiveSecondsintegerNoInactive seconds at the last location.
rpmintegerNoRevolutions per minute at the last location.
milleagenumberNoMileage at the last location.
warningTextsarrayNoWarning texts at the last location.
alertTextsarrayNoAlert texts at the last location.
alertsarrayNoAlerts at the last location.
warningsarrayNoWarnings at the last location.
hasCriticalAlertbooleanNoIndicates if there are critical alerts at the last location.
attributesobjectNoAdditional attributes at the last location.
accessoriesAttributesarrayNoAdditional attributes of accessories at the last location.
inputsarrayNoState of the inputs at the last location.
outputsarrayNoState of the outputs at the last location.

Example Successful Response

{
"success": true,
"apiUsage": 150,
"apiDailyUsage": 3000,
"lastLocation": {
"dateTime": "2024-06-02T08:48:25.009Z",
"latitude": 0,
"longitude": 0,
"speed": 0,
"course": 0,
"battery": 0,
"fuel": 0,
"fuel2": 0,
"temperature": 0,
"temperature2": 0,
"sensorTime1": 0,
"sensorTime2": 0,
"sensorTime3": 0,
"sensorTime4": 0,
"inactiveSeconds": 0,
"rpm": 0,
"milleage": 0,
"warningTexts": [
"string"
],
"alertTexts": [
"string"
],
"alerts": [
"string"
],
"warnings": [
"string"
],
"hasCriticalAlert": true,
"attributes": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"accessoriesAttributes": [
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
],
"inputs": [
true
],
"outputs": [
true
]
}
}

Example Error Response

Error 400 (Bad Request) Response

{
"success": false,
"error": "Bad Request",
"apiUsage": 150,
"apiDailyUsage": 3000
}

Error 500 (Internal Server Error) Response

{
"success": false,
"error": "Internal Server Error",
"apiUsage": 150,
"apiDailyUsage": 3000
}

This endpoint is essential for tracking the last known location of a device within the system. It allows users to obtain detailed and up-to-date information about the last recorded position of a specific device, including custom attributes and accessory data.

Plaspy GPS Tracking Platform

Explore the Plaspy platform and compatible GPS devices

Browse technical guides, application documentation, compatible trackers, and setup resources to get more value from Plaspy.