HTTPs API

0000lmht
Posts: 2
Joined: Mon Mar 13, 2023 7:45 pm

HTTPs API

Postby 0000lmht » Mon Mar 13, 2023 7:57 pm

Hi everyone,

when i use Blynk 2.0 to control relay, i can use web brower to control switch, by https api.
link : https://docs.blynk.io/en/blynk.cloud/update-property

So, with ESP RainMaker, can i do that?

Thanks.

0000lmht
Posts: 2
Joined: Mon Mar 13, 2023 7:45 pm

Re: HTTPs API

Postby 0000lmht » Sun Apr 09, 2023 6:24 am

I found the API category, however, I don't know how to use it to control the switch via url.

Can someone help me with an example of this.

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: HTTPs API

Postby ESP_Piyush » Thu Apr 13, 2023 6:09 pm

Here is how I typically use the APIs directly from the RainMaker Swagger File.

1. Search for the POST login2 API.
2. Click on "Try it out" and enter your RainMaker user_name and password and "Execute"
3. Copy the accesstoken value from the response. Go to top of Swagger file, click on "Authorize" and enter the access token value. Now, you are logged in.
4. Identify the node_id for the node to which you want to send the data.
5. Search for the PUT /user/nodes/params API.
6. Click on "Try it out", enter the following payload and "Execute"

Code: Select all

[
  {
    "node_id": "<your_node_id>",
    "payload": {
      "Switch": {
        "Power": true
      }
    }
  }
]
7. The above will turn on the switch (given that the node_id is valid and indeed belongs to you). Passing "Power": false will turn it off.

Similar can be done via Postman or any other client too. I hope this helps.

KaosESP32
Posts: 12
Joined: Tue Oct 31, 2023 9:17 am

Re: HTTPs API

Postby KaosESP32 » Wed Mar 20, 2024 3:46 pm

Hi all,

has anyone succeed on using the online version of swagger api login2 using a google account (3rd party auth) instead of user+password?

Alternatively, How to get the access token mentioned in the 3rd step using a google account as identity provider?

Thanks in advance

KaosESP32
Posts: 12
Joined: Tue Oct 31, 2023 9:17 am

Re: HTTPs API

Postby KaosESP32 » Sun Mar 31, 2024 10:06 pm

3rd Party authentication using swagger solved at viewtopic.php?f=41&t=39024
Thanks again Manali!

Who is online

Users browsing this forum: No registered users and 41 guests