Get a device service property.

Details

Get a device service property.

This endpoint retrieves the specified service selector property from all devices in the environment on which the property is defined. All properties of a specific service class can be retrieved, by using the name of the service class as the path selector, or a specific property can be retrieved, by using the name of the service class followed by the property name. When specific property names are used, only one property can be retrieved at a time.

For example, use “LightColor” to retrieve all properties of the LightColor service class, among all devices that implement that class. Use “LightColor.hue” to retrieve all values of LightColor.hue among the devices which implement it.

Each property retrieved is contained in its own JSON object within the response array.
If desired, the “refresh” parameter can be used to make sure that service selectors are specified properly. If this parameter is specified, the endpoint will explicitly reject service selectors that do not exist. By default, the endpoint ignores malformed service selectors, and in those cases returns an empty array of property information.

An account token, server token, or user token may be used to run this endpoint.

Parameters

path

  • id (required): The ID of the device.
  • selector (required): The fully qualified name of the service, as “SERVICE-NAME.PROPERTY.”

query

  • refresh (optional): Refresh the value of a service property, rather than getting its cached value. Default is false.

When "refresh" is true, the response will include a "status" property indicating a success or failure in getting the service property. The statuses include:

  • Completed
  • Failed
  • RateLimitReached

Responses

200

{
    "items": [
        {
            "ecosystemId": "ECOSYSTEM-ID",
            "index": "SERVICE-INDEX",
            "modifiedAt": "YYYY-MM-DD HH:MM:SS ENCODED",
            "property": "PROPERTY-NAME",
            "service": "SERVICE-NAME",
            "value": "PROPERTY-VALUE"
        }
    ]
}

400

  • Device Invalid: The standard error structure defines this error as invalid parameters, with an invalid ID. In this context, it means that the ID given for a client is invalid.
  • No Query String Allowed: The standard error structure defines this error as invalid parameters, with additional parameters in the query string. In this context, it means that no query string is allowed at all when calling this endpoint.
  • Service Property Invalid: The standard error structure defines this error as invalid parameters, with an invalid selector. In this context, it means that the service property given does not exist in the specified service.

404

  • Device Not Found: This error means that a device with the given ID was not found. This is distinct from an invalid device ID being specified; this means that the device ID once existed, but no longer does.
  • Service Not Found: This error means that a service by the given name and/or format was not found.

Examples

HTTP

GET https://ioe.droplit.io/api/devices/DEVICE-ID/services/SERVICE-SELECTOR HTTP/1.1
authorization: TOKEN

Droplit Console

droplit device get DEVICE-ID PROPERTY-NAME

Droplit SDK

droplit.devices.getServiceProperty("DEVICE-ID", "SERVICE-SELECTOR");
Language
Authorization
Header
Click Try It! to start a request and see the response here!