Example using new SmartThings Cloud API!

In the ST groovy docs there is a section titled writing your first smartapp. Its very basic and explains it well. Would be nice if someone would do something similar with the new api. For us beginners.


@Jim do you have any additional documentation on the OAuth flow with the new API? I noticed that in your Example Webhook SmartApp - New APIs the configuration/installation of the SmartApp was initiated from the SmartThings Mobile App, but I’m curious what the installation flow would be like from the web approach?

In the Configuration documentation, the diagram indicates that the configuration can be initiated from web or mobile:

In the Authorization and Permissions documentation, there was a reference to the https://auth-global.api.smartthings.com/oauth/token endpoint with respect to refresh tokens, but I couldn’t find any docs about initiating the OAuth flow from the web.

In the legacy groovy SmartApp approach, we would have initiated the request at /oauth/authorize specifying response_type=code and a few other parameters to get things kicked off.

@joshua_lyon oauth_in documentation/implementation still being worked on. Right now you can kick things off using a personal access token and an Oauth Token is sent back with each phase of configuration/install.

You can see more about oAuth here


Personal access tokens are useful for pretty much everything but the installed app and it’s subscriptions/schedules.

I am working on a node version of my energy monitor app that will show this flow.

Thanks, Jody. While the personal access token is great for testing a personal implementation, I’m looking for a more traditional OAuth flow where a user of the third-party app would initiate the OAuth flow directly from the third party app without having to get a manual token.

eg. The Authorization Code flow as used in the groovy Web Services SmartApp approach.


Been playing around with this new API and I have a few questions that perhaps the readers of this thread can answer. My goal is a rudimentary web version of the ST app, where everything happens on the client side (angular in the browser). Basic device info is fine, and I have pretty html per device showing name, hub-name, group-name, and how much battery is left if battery-powered etc. But the capabilities/status/actions are a bit more tricky. For example here is the capabilities list of my presence dongle:


and the corresponding status:


A good visualisation of this device would be to display “presence” as the primary value and perhaps “signalStrength” as secondary value. And there should be a “beep” button as that action is hiding behind the “tone” capability, but the similar “sensor” and “actuator” capabilities are just tags. But I don’t understand how I can get to that knowledge without hard coding lots and lots of information from the docs. There does not appear to be API calls for this at all, unless I’ve completely missed a vital part of the new docs. Trusting the order of the object inside “main” seems a bit dodgy, and it does not solve the actions.

To look for additional info, I ripped the SmartThings CLI out of the MacOS SDK blob and installed it on my Linux-box. It had quite a few additional API calls to a different Samsung web service for more OIC/OCF type info(*) but nothing that helped me with this. However the cli did have a number of files with device type asset info in a format I perhaps could import, but strangely enough not a complete set. Button was missing for example.

Bright ideas anyone?

*) Sample output:

$ /home/ok/cli/st describe device-status -i --resource-model --resource /st//capability/temperatureMeasurement/0
“rt”: [
“temperature”: 19.7,
“id”: “0”,
“units”: “C”,
“if”: [

1 Like

8 posts were merged into an existing topic: I’m perplex for the new SmartThings / SamsungConnect thing

This is my take on this whole issue:

  1. the problem … Smartthings servers often seem to become overloaded and events and other things stop working… Just look at all the outages. The current model seems unsustainable as usage keeps growing.

  2. the solution … This… New firmware, new api, require devices to offload the processing to servers other than smartthings servers to reduce the load.

  3. So If I understand correctly new device types like for ecobee, honeywell etc. will require web based processing on THEIR own servers to be compatible with smartthings in the future.

This brings up many problems… If the company is big enough they may do it. But now we have no single point of control and there will be finger pointing when there are outages.

Also, many companies are too small or I believe will not set up their own server farm and maintain it just to have smartthings compatibility. I cannot see qubino, aeon, eversource, etc settings up and maintaining servers just to support smartthings. I believe this will cause future incompatibilities with many currently supported devices.

I understand where this is coming from but don’t think it is the best solution…

On my side I do have a server or two I can use. I have a mail/dns server with public ip… I would like to see some conversion of existing devices types and smart apps going to your own server, this would be nice and would run locally instead of in the cloud and would work even if wider internet is down. At least if the server is on your local net. Probably will never see this however.

I can see a bidding war as in cable TV, where Honeywell wants hub companies to bid for access, if they say no, no service. What I see is another Pay to play system.

3 that is true for cloud connected devices that are already talking to a cloud system. But someone has to setup the integrations it may not always be the device manufacturer.

Other devices such as hub connected aren’t integrated via this api you can control them via the api but they don’t talk directly to this.

Automations smartapps etc are in the case where they need to run somewhere. Solutions like lambda will hopefully make these very approachable.

What does all of this mean for the average user? What will be changing for the general consumers?

The “average user” has never logged into the SmartThings IDE and doesn’t use any SmartApps or Device Types that are installable directly from the SmartThings App.

1 Like

And this is not new. There are already cloud-to-cloud devices in SmartThings that were integrated by users as opposed to the manufacturer. My concern is how these integrations will be converted to the new paradigm.

Ok, let me rephrase that, what does this mean for somebody like me with 200+ devices and uses the IDE to the fullest?

1 Like

It means you’d better hope the good lawd (of your preference) hears your prayers. Nothing is a sure thing with SmartThings regardless of announcements or promises.

I believe this will be very good thing “overall” in the long term. But there will be both short term pain and some serious casualties.


So (and obviously not an engineer), if the main thing needed is a place to store and run this stuff from… there’s no chance that an option for that is gonna be the USB slot on the back of the V2 hub?

From a simple end user standpoint, that would seem like a logical solution. It’d provide storage, and from what’s been said so far, the requirements for most things don’t sound like they would overtax the hub… That just seems like an obvious avenue that I haven’t seen anyone mention, so I thought I would. Please feel free to tell me all the reasons that wouldn’t work. :slightly_smiling_face:


I’m a bit late to the party in only having seen these docs yesterday. I’m a dev who has worked on IoT products and connecting products to things like Alexa. What I’ve seen in my quick browse looks really promising and much closer to how things like Google Home and Alexa work so good work there. I can see this being massively easier for third parties to integrate into than the old system.

Ironically (because I always thought smartthings was positioned to replace other hubs) there seems to be very little documentation on how to create a locally controlled device. For instance I have several wifi devices that advertise over UPNP and expose a very simple REST interface (basically following these docs). How would I write a similar device handler and smartapp in the new system?

This is not necessarily a good assumption. I started in late Jan last year working with groovy, node.js, and other apps without minimal previous SW experience (took college course in 1967). A year later, I have integrated several devices (TP-Link Plugs/Bulbs and Samsung Multiroom Speaker with presets) even though I am minimally proficient. At 69, I do not know if I am going to be able to transition to the new environment.

Additionally, I have several persons (> 1000 ) using my Service Manager and Device Handlers. Should I depreciate that thread/capability so as not to lead new users down this new rabbit hole???

Regards, Dave.

1 Like

Concur. It would be helpful to see locally controlled device examples.

Is there a way to access routines with the new api?

Hello, my name is Shin I’m trying to send POST request with postman.

All of the GET requests are working well but any POST request is malfunctioning

I send POST reqeust with postman like

“commands”: [
“component”: “main”,
“capability”: “audioVolume”,
“command”: “setVolume”,
“arguments”: [ {
“name”: “volume”,
“schema”: {
“type”: “integer”,
“minimum”: 0,
“maximum”: 100
“required”: true } ]

But I’ve got
“requestId”: “7F47FFAF-5F70-4EBA-B8~~”,
“error”: {
“code”: “ConstraintViolationError”,
“target”: null,
“message”: “The request is malformed.”,
“details”: [ {
“code”: “UnprocessableEntityError”,
“target”: “[0].arguments.[0]”,
“message”: “invalid NUMBER type”,
} ] } }

I have 2 questions.

Q1) How can I fill out the body of POST request?

Q2) If I use request module of node.js, can I just send

var options = {
method: ‘POST’,
url: ‘https://api.smartthings.com/v1/devices/“my device ID”/commands’,
headers: {
‘Authorization’ : ‘Bearer “My personal access key”’,
body: {
“commands”: [ {
“component”: “main”,
“capability”: “audioVolume”,
“command”: “volumeUp”,
}]} };

Thank you in advance