Getting devices and events via the SmartThings API


I’m not a full developer, but I`m working with home automation and hence trying to accomplish the following using the SmartThings API:

  1. List devices (initially a dryer and a washer)
  2. List device events

Later on I might try other things, but this is my initial plan in order to see how the API works and what can be done.

Based on the following guide:

I have performed the following (using PowerShell):

  1. Created a SmartApp with OAuth enabled. The app code is not modified beyond the default template.
  2. Request an authorization code.
  3. Use the code to request an access token.
  4. Get the endpoint URI for the SmartApp.

I get 4 URLs, one example:

When trying to send a GET request to the URL`s, I get an “The remote server returned an error: (403) Forbidden.”.

If I append /devices to the URLs, I get an “The remote server returned an error: (404) Not Found.” error.

What do I need to do to proceed to get a list of devices and their events?

Using the current API, you can’t, without first writing an entire SmartApp that allows the user to Authorize which devices you are allowed to access, and then defines custom REST-API endpoint mappings to perform specific functions on those Devices, such as fetching their Events and responding in JSON.

Please read this section of the Docs much more carefully:

You may also want to consider the “new” Samsung SmartThings Cloud API, though it is only in Beta, docs are incomplete, and subject to change. And you will find less peer-support for it.

Ah - thanks a lot. I`ll look into the new beta API instead.

1 Like

I just started working on a project using this API, but the documentation seems to have a problem.

The page just shows “Loading” when I try to open it.