Calls services on the device.

Request syntax

POST /2019-09-30/things/ ProductKey/DeviceName/services HTTP/1.1
Cookie: Cookie


Request Parameters

Parameter Type Required Description
ProductKey String Yes The unique identifier of product to which the device belongs. You can obtain the value of this parameter from the IoT Platform console.
DeviceName String Yes The name of the device. You can obtain the value of this parameter from the IoT Platform console.
Cookie String Yes The authentication cookie generated when the CreateAuthCookie API operation is called.
Payload JSON Yes The name and the parameters of the called service. The name and the parameters of the service must be the same as those that are defined in the product TSL of the device in IoT Platform. For more information, see the request Payload format.

The format of the request Payload is as follows:

  "Services": [
      "Name": "string",
      "Args": args // Optional arguments for the service.

Response syntax

HTTP/1.1 StatusCode
Content-Type: application/json


Response Parameters

Parameter Type Description
StatusCode Number The status code of the operation. If the request is successful, 200 is returned. If the request fails, other status codes are returned. For information, see Status codes.
Payload JSON The response of the service call.

The format of the returned Payload is as follows:

  "Code": 200,
  "Message": "sucess|reason for failure",
  "Data": {
    "Services": [
        "Name": "string",
        "Returns": {
          "Message": "success|reason for failure",
          "Data": string|boolean|number|array|object, // A optional data that returned from the underlying call services call.
      "Timestamp": 1568262117344


$ curl -i -b token.cookie -d '{"Services":[{"Name":"setColor","Args": {"color":"red"}}]}' -k -X POST***/N0hB9tiVWWZFMpALK***/services

HTTP/1.1 200 OK
Server: openresty/
Date: Thu, 31 Oct 2019 11:17:47 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive