Power Automate Tutorial - How to connect a Rest API

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome to my channel this is the rpa champion  and in today's video we are going to see how   we connect rest apis to a power automate  flow this is going to be super exciting and   super fun why because rest apis can add a lot of  functionalities to our power automate flows what   do i mean by a lot of functionality so in today's  video we are going to learn how to create an rest   api call before we do that and before we connect  it and create it from scratch let's just see   what it looks like and why rest api  calls are so useful so this is a   flow that i created previously let's just peek  inside and see what it looks like so we have a   manually triggered flow meaning when i click a  button in power automate or on another service   i make a http request meaning that i connect to  a link via get i download the information via   json i parse this json in a suitable format then  we take this information and we put it inside a   google sheet after that we run a condition  on the on the information that we extracted   and we do something according this is this kind of  the logic flow i wanted for you to see it before   we get down actually and we start creating and  doing it for ourselves so before connecting a   rest api it is usually good practice to choose an  api that you want to connect so in this example we   are going to be connecting to a finance api and  what we are going to be doing more exactly is we   are going to be connecting to uh our finance api  and we are going to be checking the stock for ibm   we are going to be checking the opening stock  and then the closing stock for the trading day   and the closing stock is higher than the opening  stock that means that the stock has gained in that   day and we would want our flow to behave certainly  if we have gained in our stock or if we have lost   in our stock so without further ado let's get  started and let's start from the beginning so   we are going to create a automatically  triggered flow so let's call it stock stock checker this is going to be a  manually triggered flow let's create it and   now the first step that we need to do is  we need to add a http request so we need to   get a http request and this request is going to  be made via get so i have chosen alpha advantage   as my api for the stock it has great  documentation it is free to use there is different   they have different for different kind of  information that you want to see i highly   recommend it if you are interested in financial  data so i have uh i have already found a link so   this is this is the link that we are going to be  using so it's a time series daily and it's for ibm   and what does it look like so it tells me the  symbol it tells me the last date that it was   refreshed and it also tells me day  intervals so what i would like to do   is take the opening and the closing of the last  day understand the difference and if the closing   is higher than the opening uh send an email maybe  that says you have gained some money on your stock   so perfect all right let's get back into it let's  get the link that we want to connect to so we can   also find this is the links this is a json output  link this is the right kind of link that we need we're going to paste it here we don't need  this any any headers information or body alright so let's save this and  test it and see what happens all right so once triggered we see that power  flow went to this output and it captured something   it it returned a response this  response is not making a lot of a lot of sense because we have to work with it and   transform it for our purposes  so let's add a new step let's add a not a data operation let's add a json i apologize about that few spelling mistakes parse  the json so here we are going to put the body   and we're gonna generate the schema  from this schema that we have right   here so we're just gonna copy and paste everything and we are going to save save our information   now what is the next thing that we have to do the  next thing that we wanted to do is maybe add this   information and put it in a readable format maybe  in an excel sheet so let's create excel sheet so in my in my case i will not be  creating an excel sheet i will be creating   a google shared drive sheet or google  sheets so just one second while i here we go we are going to create a new  sheet we are going to call it ibm stock we will have the symbol open close and that's pretty much it for right  now we don't need we don't need there is a   lot of more detail that we can add but for the  purposes of this example let's just keep it   simple save let's add one more step the other  step that we're going to add is google sheets   so let's look for sheets google  sheets and i would just like to   highlight you guys how simple this all of  this has been so far so what we are going   to do is we are going to insert a new row  inside of our file that we have just created power automate and let's choose  the ibm stock file so worksheet sheet1 now if i uh right uh power automate has automatically  identified the different columns that we have   now just keep in mind if you're using excel you  are you should create a table inside of excel so   that power automate can automatically identify  the uh the headers of the different columns   so let's put the symbol in here and let's take the  open and let's take the close this is perfect i   think we should have required one more field which  could have been the date but let's just test this   and see if it's working so our script has  failed let's see what is the reason of this   okay let's let's change our json  file something is wrong with it let's try to format it one more time this should this should work let's test it again our process has failed very well now why is this not working this should be correct   the request oh all right we have wrong  link here so let's edit this on the fly i have no idea how that link how that link got there but this should this  should fix our problem so now let's test   our flow one more time and our flow is running it has completed  successfully it has passed the json and   it's telling us that it has successfully inserted  everything inside of our google sheets so let's go   back ibm open and ibm close that is perfect it has  dynamically via api collected the stock price and   it has put it on this google sheet now just for  fun let's do one last thing let's add a condition that is going to check if the  opening price is greater than the   is lower than the closing price that means uh  it is going to tell us what happened with that   with that stock so control condition and this  is just going to be a really easy example to   show you guys how to add a condition in a really  simple way and in a very dynamic way so what we're   going to do is we're going to get the data from  so here in parson json we're going to look for   the first values of open and close  so we have the open so if open is greater or if open is let's go this  way if open is less than closing value so well what this basically means if uh when  the stock opens if it's less than what it closed   that it means it has gained so we are going  to send an email saying that our stock has gained so send an email let's  just send it to myself for example and let's add something dynamic  let's add the stock ticker if i can get to it and inside the body let's add one is  this correct so when it opens is less than close so that means when it's closed it's higher we won stock gained and on this side let's add another  condition it's going to be the same condition   and inside of this condition no i apologize  we are going to add a email and email option and we're going to send it again the same  information just keep in mind you can also   copy and paste different parameters like i have  just done lost and when this one lost your stock   lost all right are we ready to  test this so let's see how the uh   ibm stock has behaved today  manually we're gonna test this   so what should happen let's walk through this  one more time it should we triggered the api we   connected to the http via get and we pulled down  all of the information in the json format now we   pass this json so that we can have we can access  this information that we have downloaded via   api call and then we have stored what we have  selected to choose inside an excel on google sheet   and after that we have also created the condition  that checks if the stock is higher or if it's   lower based on how the stock has behaved during  the day it sends an email so if i go back to my panel for my flow i can see it has  executed successfully if i go inside of   my excel i see a new row has been added  correctly and if i go into the email   i should have received an email and  here is the email your stock lost so this is pretty much everything  that we cover in today's video just to recap once again in today's video you've  learned how to connect to a rest api yeah power   automate this is going to open you to a whole  world of possibilities and different flows   that you can create i really hope you liked it  subscribe if you haven't so that you can get some   more interesting and entertaining content like  this and please give me a thumbs up so that i can   become a millionaire one day awesome thank you so  much guys for watching see you in the next video [Music] you
Info
Channel: RPA Champion
Views: 37,124
Rating: undefined out of 5
Keywords: microsoft power automate tutorial, microsoft power automate desktop tutorial, power automate, microsoft power automate, power automate tutorial, microsoft flow tutorial, power automate desktop, microsoft automate, power platform, power automate desktop introduction, power automate desktop tutorial, power automate desktop web automation, power automate desktop app, power automate desktop flow, power automate desktop free, rpa champion, what is microsoft flow, ms flow
Id: 5SPnhrfE-wM
Channel Id: undefined
Length: 16min 44sec (1004 seconds)
Published: Mon Jan 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.