Routine creation via SmartThings API

Hello,

I succesfully developed the integration of my company IoT device and certified the product trough the developer console.

The device is mainly a power meter that measures real time power consumption and photovoltaic power production.

I have some qiuestions related to some new development:

  1. I would like to know if it could be possible to create Rules inside a user SmartThings instance using SmartThings API.
      1. I’ve seen ST API documentation but i don’t know how to generate the tokens required to make the api calls.
  2. Moreover I would like to use as trigger not only my device or other ST device’s parameters, but some external data (such as a parameter on my DB or some data obtained by a third party API), is it possible to use such triggers inside a Rule made via ST API?
  3. If I could only use as trigger some data that is already inside my devices properties, could it be possible to add or modifiy the existing capabilities inside my certified device? If so, what are the constraints?

Thank you in advance for your support

Hi, @emanuele.d1994
Sorry for missing this post.

About your questions:

Do you mean creating the Rule for the user instead of him/her creating it directly?
To do something in their name, you cannot use the Schema Connector token.
You would need to create a separate integration called the API_ONLY app to get Access Tokens

However, this has other limitations, like the number of installs and the location-level access. If you want something with greater possibilities, you need to form a partnership with SmartThings.

This wouldn’t be a Rule anymore because this feature has established properties that can be used and an external parameter isn’t one of them
It would be an automation where you receive the external event, and then use the valid access token you got to send commands to the devices.

This is part of the first answer, you need a valid API_ONLY app Access Token to control the devices it has access to (it can be to all the devices in a location or specific ones).