Invoke REST API from Power Automate Desktop

Invoke REST API from Power Automate Desktop

Power Automate Desktop

Invoke REST POST and GET API from Power Automate Desktop


API Reference and Endpoints

For links to the {JSON} Placeholder and a list of the API endpoints, see API Reference and Endpoints.

  • Use the following URL and POST for the REST API call
  • Headers:
    • Content-Type: application/json
  • Body :
1
2
3
4
5
6
7
{
    "title""My Test",
    "body""Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
    "userId"1
}
  • Response:
1
2
3
4
5
6
{
    "title""My Test",
    "body""Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
    "userId"1,
    "id"101
}
  • Use the following URL and GET for the REST API call
  • Headers:
    • Content-Type: application/json
  • Response:
1
2
3
4
5
6
[
    {
        "userId"1,
        "id"1,
        "title""sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
        "body""quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
    },.......... ]

Now that we know the basics of REST API and also understand the  REST Endpoint lets Invoke REST API from Power Automate Desktop.

Power Automate Desktop(RPA) solution

Step 1:

Launch the application and select New flow in the console. Enter a name for the Desktop flow, and select Create.

Step 2:

This is where the real magic happens. In this step, we will use The {JSON} Placeholder Online REST API and Send A GET Request


Step 2:

Add the “Convert JSON to custom object” action to the Power Automate Canvas and set the parameter below:

  • JSON: %WebServiceResponse% the Output of the “Invoke Web service” action,

Step 3:

The response returned by the API is a JSON Array. Add a Display message task and read the response. Below is how to get a specific response from the array

%JsonAsCustomObject[0].id%

Step 4:

This is where the real magic happens. In this step, we will use The {JSON} Placeholder Online REST API and Send A POST Request


NB: In the Advanced Button Disable Encode request body

Step 5:

Add the “Convert JSON to custom object” action to the Power Automate Canvas and set the parameter below:

  • JSON: %WebServiceResponse2% the Output of the “Invoke Web service” action,

Step 6:

The response returned by the API is a JSON Array. Add a Display message task and read the response. Below is how to get a specific response from the array

%JsonAsCustomObject[0].id%

That is it, run the Power Automate Desktop Flow. You are now able to Send a GET and POST Request in Power Automate Desktop.

Invoke REST API from Power Automate Desktop

“Wherever you go, no matter what the weather, always bring your own sunshine.”

June 12, 2023

0
0

Comments

+

© 2024 Inc. All rights reserved. mulikevs