Status.retrieve

Description

Retrieves the values of a status component stored in Lhings by the given device between two given dates.

Request specification

  • Method: GET
  • URL: /devices/{uuid}/states/{componentName}?begin={beginTimestamp}&end={endTimestamp}& page={numPage}&human_readable={true|false}&older_first={true|false}

  • Call parameters:

    • uuid: mandatory. The uuid of the device whose status will be stored.
    • componentName: mandatory. The name of the status component (e. g., "temperature"), the service will return data about this status component.
    • beginTimestamp: optional. Data with timestamps older than this date will be returned. It can be provided as a Unix timestamp or in ISO 8601 format. Defaults to Unix time 0 (i. e., January 1st, 1970 at 00:00 UTC).
    • endTimestamp: optional. Data with timestamps earlier than this date will be returned. It can be provided as a Unix timestamp or in ISO 8601 format. Defaults to current time.
    • numPage: optional. The service will paginate results, with a maximum of 1000 results per page. This parameter is used to select which page must be returned. Defaults to zero (first page).
    • humanReadable: optional. If true results will show timestamps in ISO 8601 format, Unix timestamps will be provided otherwise. Defaults to false.
    • olderFirst: optional. If true results will be ordered from older to newer. Newer results will be returned first if false. Defaults to true.

Example Request

  • Request URL: https://www.lhings.com/laas/api/v1/devices/11111111-2222-3333-4444-555555555555/states/temperature?begin=1392600000&end=1392700000
  • Request headers: X-Api-Key: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee Content-Type: application/json
  • Request method: GET

Example Response

  • HTTP status: 200 OK
  • Response body:
    [ {"tst": 1392600000, "val": 27.1}, {"tst": 1392600005, "val": 27.6}, {"tst": 1392600017, "val": 27.9}, ... ]

Error summary

  • 400: bad request, some of the parameters provided are not valid (e. g., begin greater than end, negative or bad formatted timestamps, negative page, etc.).
  • 401: Api key not provided or invalid.
  • 404: the device with the given uuid does not exist, or the status component requested does not exist.
Back to top