Status.store

Description

Asks Lhings to store the status of a device. The status is stored using the timestamp of the server, although a user defined timestamp can be provided. All or only some of the components of the status of the device can be stored.

Request specification

  • Method: POST
  • URL: /devices/{uuid}/states?timestamp={timestamp}
  • Call parameters:
    • uuid: mandatory. The uuid of the device whose status will be stored. Mandatory.
    • timestamp: optional. The status will be stored as if was generated at the the time indicated by this timestamp. It can be provided as a Unix timestamp or in ISO 8601 format.
  • Request body: a list of key - value pairs where the key is the name of the status component (e. g. temperature), and the value, its current value.
    { "componentName1": "value1", "componentName2": "value2", ...}

Example Request

  • Request URL: https://www.lhings.com/laas/api/v1/devices/11111111-2222-3333-4444-555555555555/states/?timestamp=1234567890
  • Request headers: X-Api-Key: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee Content-Type: application/json
  • Request method: POST
  • Request body:
    {"hour":1234567890, "text":"scooby doo", "temperature": 34.7, "on": true}

Example Response

  • HTTP status: 200 OK
  • Response body:
    {"responseStatus":200,"message":"OK"}

Error summary

  • 400: bad request, some of the status components do not exist, the type of the value provided is not the one expected for that component, or the timestamp provided is incorrectly formatted.
  • 401: Api key not provided or invalid.
  • 404: the device with the given uuid does not exist.
Back to top