FAQ: Getting Started with the new Rules API

At SDC19, we previewed our new Rules Grammar and API that allows you to create simple and complex automations that can operate on the SmartThings cloud. In a future release of the API, local execution of rules on SmartThings hubs will be supported - making rules a great choice for those looking to create fast, stable and secure automations. We are excited to announce a few resources available for everyone to start testing:

We know you have will feedback and requests - we are working hard to add more features to the API (such as variables and expressions). Feel free to drop your ideas, questions, and comments here!

10 Likes

I clicked on the link using both Chrome and Safari and it came to the page to authorize my Samsung account and it does nothing. Is it not working? OK got in using the top link.

welp, there goes my Thursday night…

3 Likes

Great timing!

1 Like

Does each “Rule” count as an “App”? If the limit is 100 then how does this limit affect those people like me that have close to 300 devices? Say I only had 1 rule per device, then I would be screwed after the first 100 rules. :man_shrugging:t5:

2 Likes

Hi, @rontalley

Rules are treated independently of installed apps, before the update the rules were available through the ST API as behaviors, but now you can browse, create and update them at the Rules API.

UPDATE
These are the Rate Limits for the Rules API to prevent runaway installs through the API. However, we’re evaluating the option of increasing such limit.

image

1 Like

Will new webcore which uses rules API
as previewed in https://sdc.webcore.co be available?

What is ISA?

1 Like

Hi, @prjct92eh2

Refers to installed smart app.

@iquix, if it’s installed/created following the Rules API Gramar, it will do. but as an external SmartApp, it should accomplish the SmartApp lifecycle syntax and then being created at the INSTALL lifecycle through the SmartThigs API.

1 Like

How does glitch.com play into all of this? Does it replace github? Does RulesAPI run on glitch?

It’s just a neat way of delivering a live, working proof of concept that people can play with and also peek under the covers to see how it’s built.

The actual Rules API runs on the SmartThings platform. You can interface with the Rules API directly via the REST API. The ‘Example Rules Manager’ isn’t intended as a production, end-user facing tool - more of a proof of concept for developers to poke around with and better understand how things work.

Glitch is a neat choice for the ‘Example Rules Manager’ as it has some nice features like being able to run Node.js server-side code and maintain secrets like are necessary for the OAuth portion. It also makes it really easy for people to fork and play with the underlying code.

2 Likes

damn overly sensitive work firewall :frowning:
image

@erickv did the behaviors API documentation dissapear? I don’t see it listed anymore
https://smartthings.developer.samsung.com/docs/api-ref/st-api.html#section/Overview

1 Like

Ya, mine just spins on loading project.

Also used wrong/old ST email address so I kind of hosed myself there too :man_facepalming:t2:.

1 Like

Hi @prjct92eh2,

Basically the /behaviors URL has been updated to /rules.

Regarding the error message, you just opened the webpage?

UPDATE
@prjct92eh2, @kevin try this url https://glitch.com/~smartthings-rules-manager instead

Looks like behaviors API still returns the values for the automation creator, and rules API does not. So they seem slightly different at this point.

@prjct92eh2 Do you mean that at the moment of posting the JSON rule to the Rules API you don’t receive a copy of the JSON rule with the id attached?

Behaviors are still working, so, at the moment you create a new rule, it will reflect at your behaviors list, it also works with the opposite process.

I’d recommend you to approach the Rules with Postman/Insomnia and a Personal Access Token. Then use the SmartThings Rule Manager to enhance your rules development.

Is there a difference between turning on a light upon motion by creating an automation versus

They appear to be two different concepts but achieving the same result.

@erickv is a GET using the Rules Manager Testing App supposed to return all rules created via the Rules API, or only rules created with that specific testing app? I’m trying to remove one I created with the POC webCoRE from SDC.

1 Like

Hi, @prjct92eh2

At this time, the token issued is scoped as a testing app, therefore it can access just the rules created locally.

What’s the purpose of “Execute a rule”? After you have created a rule, isn’t the rule already taking effect? Or do you have to have it executed before it will take effect? If yes, how do you suspend a rule after it is taking effect? If no, can you give an example of when “Execute a rule” is used?

Thanks.