Getting Started With API call to control devices (Life after WebCORE)

Hi, @Moebius

Yes, that is part of the legacy platform and based on its configuration you enabled access for third-parties like WebCORE to control your devices.

So, if I understand correctly, your lights and ceiling LEDs are connected to the ST Hub and want to execute something based on a third-party event, right?

Currently, you can use the SmartThings API (with a Personal Access Token as the authentication) to send commands (REST requests) to devices from different sources. For example:

//this is the URL:
https://api.smartthings.com/v1/devices/deviceID/commands

//This is an example of the body turning on a light
{
    "commands": [
        {
            "component": "main",
            "capability": "switch",
            "command": "on",
            "arguments": []
        }
    ]
}

//This is an example of the body changing the color of a light
{
  "commands": [
    {
      "component": "main",
      "capability": "colorControl",
      "command": "setColor",
      "arguments": [{hue:53,saturation:45}]
    }
  ]
}

The device ID can be found if you list the devices with this URL: https://api.smartthings.com/v1/devices

There’s a tool called SmartThings CLI which allows you to interact with the API through the console, here are the instructions to install it: Get Started With the SmartThings CLI | Developer Documentation | SmartThings

Also, users like to use this tool created by a Community developer that allows you to interact with the API through a web browser:

2 Likes