English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Debug APIs with API Explorer

Last Updated on : 2022-09-21 03:50:37download

This topic describes how to subscribe to device control API products, and use API Explorer to check API calls and troubleshoot issues on the Cloud page of the Tuya IoT Development Platform.

Prerequisites

A sub-device is added to Tuya IoT Edge Gateway (TEdge). For more information, see Manage Devices on Tuya IoT Edge Gateway.

Procedure

  1. Choose API Products > Industry Project and subscribe to Industrial General Device Control. For more information, see Manage API Products.

  2. Choose Subscribed Products > Industrial General Device Control > Authorized Projects (Authorize) > New Authorization, and select your project in the dialog box that appears.

  3. Choose Cloud > API Explorer and send control commands. For more information, see API Explorer.

  4. Send control commands with API Explorer.

    • Choose API Explorer > Control Device and set the device_id field. You can get the value of device_id on the Sub-devices page of Tuya IoT Edge Gateway.
    • Set the commands field. The following code block shows the sample code:
      [
      	{"code":"switch_1","value":true},
      	{"code":"countdown_1","value":318}
      ]
      
  5. View device logs.

    Go to the Log query page of the Tuya IoT Development Platform and enter the device ID to view device logs.

    Debug APIs with API Explorer

  6. View sub-device status.

    At the edge gateway, you can view the latest status of the sub-device for the edge gateway.

    Debug APIs with API Explorer