Skip to content

Asset Tracking APIs

Use the following APIs to update and retrieve the geographic location of your devices

1. Update a device's geographic (GPS) location.

curl https://api.socketxp.com/v1/devices/location/:device_id \
  -X POST \
  -H "Authorization: Bearer <your-auth-token-goes-here>" \
  -d '{"Lat": 37.813699649742475, "Lng": -122.47787639433689}'

Description:

If your device has a GPS integrated with it or if you could fetch the device's GPS co-ordinates(Longitude and Latitude) from your 4G/5G network provider or using Google's GeoLocation API, you can update the GPS co-ordinates of your device with SocketXP using the following API.

This API is useful if you want to view your device's geo location in the SocketXP portal's map view.

Note: The Latitude and Longitude values are float values and not string.

Sample Usage:

curl https://api.socketxp.com/v1/devices/location/1abc-abcde-acbdefgh-a1b3c3d4-abc \
  -X POST \
  -H "Authorization: Bearer <your-auth-token-goes-here>" \
  -d '{"Lat": 37.813699649742475, "Lng": -122.47787639433689}'

Sample Response:

200 OK

2. GET a device's geographic (GPS) location:

curl https://api.socketxp.com/v1/devices/location \
  -X GET \
  -H "Authorization: Bearer <your-auth-token-goes-here>" 

Description:

The API returns a list of all devices with its GPS co-ordinates currently stored in our cloud gateway's database.

Sample Usage:

curl https://api.socketxp.com/v1/devices/location \
  -X GET \
  -H "Authorization: Bearer <your-auth-token-goes-here>" 

Sample Response:

[
  {"DeviceId":"abc-1234-abcdef-5678-a1b2c3d4-abc","Lat":0,"Lng":0},
  {"DeviceId":"efg-1234-abcdef-5678-a1b2c3d4-efg","Lat":-26.034009300296415,"Lng":27.954121158800206}
]