Get device coordinates
Returns the coordinates of a device's installation site — latitude and longitude stored in its settings. The server does not determine coordinates itself: they are set with set_device_coordinates_req, when creating the device, or in the web interface.
Request and response: get_device_coordinates_req → get_device_coordinates_resp.
Access: a low access level token sees the devices of its application and of applications that granted it access; a high access level token sees all devices of the owner.
Request
Fields not marked as required may be omitted.
| Field | Type | Description |
|---|---|---|
cmd | string | get_device_coordinates_req |
operation_id | string | Any string; the server returns it in the response to match the request and the response |
devEui | string | Device DevEUI, 16 hex characters. Without it the server returns all available active devices |
{
"cmd": "get_device_coordinates_req",
"operation_id": "1W3fd",
"devEui": "D745F677B2412E03"
}
Response
| Field | Type | Description |
|---|---|---|
cmd | string | get_device_coordinates_resp |
operation_id | string | Value from the request |
status | uint8 | 1 — success, 2 — error |
deviceCount | uint32 | Number of devices in the list |
deviceList | array | Devices: devEui, lat — latitude, lon — longitude, in degrees. null if coordinates are not set |
error_code, error_text | uint8, string | Only on error, see below |
{
"cmd": "get_device_coordinates_resp",
"operation_id": "1W3fd",
"status": 1,
"deviceCount": 1,
"deviceList": [
{
"devEui": "D745F677B2412E03",
"lat": 43.2217921642226,
"lon": 76.8974626064301
}
]
}
Errors
error_code | error_text | What happened |
|---|---|---|
| 3 | Data is filled in with an error | devEui is not 16 hex characters |
| 0 | — | Internal server error — retry later |
A device that does not exist or is not available with your token is not treated as an error: it is simply absent from deviceList.
See also
set_device_coordinates_req— set coordinates.