I’m a little bit in trouble because I haven’t actually understood how to use API Rules.
The part I am actually missing is how to log in: I have read it requires the token (I have it) and it uses the HTTP Basic authentication, but I don’t know “how” to write these info in the URL.
Is there a particular browser I should use to log in and write APIs?
It doesn’t use HTTP Basic auth. It uses the Authentication Header with a value of “Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” where the x’s are your Personal Access Token. You call the API https://api.smartthings.com/v1/rules as a POST with the body indicating the Action to be taken and the content of your rule, as appropriate. See API | Developer Documentation | SmartThings for more info.
As has been pointed out, Rules are created using an HTTP POST with the Rule in JSON format in the body. Authentication uses an ‘Authorization’ Header with a token in it. So basically there is a bit more than a URL to consider.
Some users like to use tools like Postman to manage their Rules. I’ve made many attempts to try using it but I simply can’t be bothered with it. I much prefer to create my Rules as text files and submit them using command line tools. I tend to use the CLI for handling Rules as this has a built in YAML to JSON conversion and I prefer to use YAML for Rules. I haven’t actually tried writing Rules in any other languages as I am not doing anything too complicated.
Just to note that by default the CLI will prompt you to authenticate as a user and it will then automatically maintain an app token for use with the API. This works pretty much the same as a personal token does for most things, but when it comes to Rules things are a little different. The CLI will, by default, only manage the Rules it created itself using the app token. So when it comes to Rules I prefer to override the default authentication by specifying a personal token (I actually define different profiles in the CLI but the effect is the same as specifying a token on the command line). This just makes the Rules a little more accessible.
I have used it and it has worked great for me… I am definitely not skilled enough with JSON to do everything I’d like to, but I have done what I actually needed