Skip to main content

Set device coordinates

Stores the coordinates of a device's installation site — latitude and longitude — in the device settings. Coordinates are needed, for example, to show the device on a map. The server only checks that they are numbers; it does not check the range or refine the coordinates.

Request and response: set_device_coordinates_req → set_device_coordinates_resp.
Access: a token of any access level sees the devices of its application and of applications that granted it access.

Request​

Fields not marked as required may be omitted.

FieldTypeDescription
cmdstringset_device_coordinates_req
operation_idstringAny string; the server returns it in the response to match the request and the response
devEuistringRequired. Device DevEUI, 16 hex characters
latfloatRequired. Latitude, degrees
lonfloatRequired. Longitude, degrees
{
"cmd": "set_device_coordinates_req",
"operation_id": "1W3fd",
"devEui": "D745F677B2412E03",
"lat": 42.221848,
"lon": 75.898052
}

Response​

FieldTypeDescription
cmdstringset_device_coordinates_resp
operation_idstringValue from the request
statusuint81 — stored, 2 — error
devEuistringThe device
lat, lonfloatStored coordinates
error_code, error_textuint8, stringOnly on error, see below
{
"cmd": "set_device_coordinates_resp",
"operation_id": "1W3fd",
"status": 1,
"devEui": "D745F677B2412E03",
"lat": 42.221848,
"lon": 75.898052
}

Errors​

error_codeerror_textWhat happened
2Required field is not filleddevEui, lat or lon is missing
3Data is filled in with an errordevEui is not 16 hex characters; lat or lon is not a number
8Device does not existsThe device is not found, inactive or not available with your token
0—Internal server error — retry later

Good to know​

  • The server does not check the range: latitude must be from −90 to 90, longitude from −180 to 180. Check the values on your side.
  • Do not mix up the fields: lat is latitude, lon is longitude.

See also​