API Sample Request

Last Updated on : 2023-06-27 03:13:18download

This topic describes how to use Postman to make API requests and control devices. A robot vacuum is used as an example in this topic.

Prerequisites

Procedure

  1. Get a token.
    Call the Get access_token with simple mode operation to get the value of access_token. The value is required when you call API operations to control devices.
    API Sample Request

  2. Call the Get the function list operation to get the instruction set that is supported by the device. You can use the instruction set to control the device.
    API Sample Request

  3. Call the Send device commands operation to control the device. You can send a command that is supported by the device to achieve the required effect.

    Note: For more information, see API Reference.

API Sample Request

The following code block in the API request body shows how to start a robot vacuum:

{
	"commands":[
		{
			"code": "power",
			"value":true
		}
	]
}

Operation result

The robot vacuum is started to run as expected.
API Sample Request