Using HTTP Request in Microsoft Flow.

Hello Guys,

In our previous blog we have learnt what is Bound and Un Bound action in CRM and how to call this action in Microsoft Flow. Today we are going to learn how to make HTTP Request in Microsoft Flow. But before If you are new to MS Flow then please read my this blog.




Do follow us to know more about Dynamics and Power Platform. Also if you like our blog then please comment and share this blog with your friends.

We have come across many situation where we need to use external or internal API. For example while integrating Dynamics 365 with third party we need to use their APIs. Also some time we are creating our own APIs for our internal purpose.

Today we will see how we can use APIs with Microsoft Flow. For demonstration purpose we are using one rest API i.e. https://gorest.co.in which is free of cost. You can get free APIs for testing purpose online.

Here we will retrieve users and will create a new user using API with the help of Flow. So first of all we will be creating our flow.

Navigate to https://us.flow.microsoft.com and select your environment. Click on Create and select instance. Configure it as below and click on create.




Add a new step and search HTTP. Configure it as below.




AS you can see we have GET request which will be used for retrieving user list from the API. Now we will be adding a new step which will be Parse JSON so that we can create output of the users in proper format.




Now we will be selecting user using Select Data operation. Add a new step and search select and configure it as below.




So now will run this flow and will check it is running as expected or not.




As you can see flow has run successfully and we got below JSON outputs.

[
  {
    "ID"5,
    "Name""Puneet Gandhi DC",
    "Gender""Male",
    "Status""Active"
  },
  {
    "ID"6,
    "Name""Sen. Geeta Patil",
    "Gender""Female",
    "Status""Active"
  },
  {
    "ID"7,
    "Name""Mr. Chandni Sharma",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"8,
    "Name""Ankal Varma IV",
    "Gender""Male",
    "Status""Active"
  },
  {
    "ID"10,
    "Name""Madhuri Rana",
    "Gender""Female",
    "Status""Active"
  },
  {
    "ID"12,
    "Name""Tanya Mukhopadhyay",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"13,
    "Name""Avantika Mehra",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"14,
    "Name""Anandamayi Bhattathiri",
    "Gender""Male",
    "Status""Active"
  },
  {
    "ID"15,
    "Name""Sukanya Varma",
    "Gender""Male",
    "Status""Inactive"
  },
  {
    "ID"16,
    "Name""Bhagirathi Gandhi",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"17,
    "Name""Dhaanyalakshmi Bharadwaj",
    "Gender""Female",
    "Status""Active"
  },
  {
    "ID"19,
    "Name""Gov. Saroja Patil",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"20,
    "Name""Gudakesa Butt",
    "Gender""Female",
    "Status""Active"
  },
  {
    "ID"23,
    "Name""Sujata Nayar PhD",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"24,
    "Name""Ms. Bilva Butt",
    "Gender""Male",
    "Status""Active"
  },
  {
    "ID"25,
    "Name""Gurdev Malik",
    "Gender""Female",
    "Status""Inactive"
  },
  {
    "ID"26,
    "Name""Washington Luis Cabral da Silva",
    "Gender""Male",
    "Status""Active"
  },
  {
    "ID"27,
    "Name""Damodara Sharma VM",
    "Gender""Female",
    "Status""Active"
  },
  {
    "ID"28,
    "Name""Mandakini Asan",
    "Gender""Female",
    "Status""Active"
  },
  {
    "ID"29,
    "Name""Naveen Asan",
    "Gender""Male",
    "Status""Inactive"
  }
]

Now will add new step in which we will use HTTP request using POST method. Click on Add new step and select HTTP and configure it as below.




Now run the flow again and check whether it is creating a new user or not.




As you can see we got status code 200 which means our user created successfully. 




You can use other methods like, PUT, PATCH and DELETE too.

Hope it helps...

Comments

Post a Comment

Popular posts from this blog

Read Only Sub Grid & Editable Sub grid in Dynamics 365

Using Pipelines in Power platform for deploying solutions to environments.

Understanding Sales Process in D365.