Device.setDescritor

Description

Used by devices to upload their device descriptor to Lhings.

Request specification

  • Method: PUT
  • URL: /devices/{uuid}/
  • Request body: the device descriptor in JSON format.

Example Request

  • Request URL: https://www.lhings.com/laas/api/v1/devices/11111111-2222-3333-4444-555555555555/
  • Request headers: X-Api-Key: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee Content-Type: application/json
  • Request method: PUT
  • Request body:
    {
        "modelName": "288 GTO",
        "manufacturer": "Ferrari",
        "deviceType": "sport car",
        "serialNumber": "SN04732",
        "friendlyName": "My Ferrari 288 GTO",
        "uuid": "13dfc9c7-f8f2-4cd0-9472-89c1b179144f",
        "version": 1,
        "stateVariableList": [
            {
                "name": "Driver family name",
                "type": "string"
            },
            {
                "name": "Engine temperature",
                "type": "float"
            },
            {
                "name": "Trip started",
                "type": "timestamp"
            },
            {
                "name": "Distance travelled km",
                "type": "integer"
            },
            {
                "name": "Engine status OK?",
                "type": "boolean"
            }
        ],
        "actionList": [
            {
                "name": "speed up",
                "description": "accelerates the car up to a given maximum speed",
                "inputs": [
                    {
                        "name": "maximum speed kph",
                        "type": "integer"
                    }
                ]
            }
        ],
        "eventList": [
            {
                "name": "fuel low"
            }
        ]
    }

Example Response

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

Error summary

  • 200: success.
  • 400: bad request. Usually caused by a wrong syntax in the descriptor.
  • 401: Api key not provided or invalid.
  • 404: given uuid does not match any installed device.
Back to top