API : UiPath API Automation - Get, Create, Update and Delete Request Methods

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] and I welcome you back to my channel today we are going to learn a new topic in the API series how do you get the data from using an API how do you create a new entry in the server using API this is new and then update existing entry there is an existing entry in the server you need to update that using API and you need to delete an existing data so how all this can be done using API we are going to learn from this video so please do subscribe to my channel before we get started and do support me so let's get started and understand now the very first thing we need an API so this time I am going to show you a different API which we can use for practice purpose so the name is risk request address okay if you type req and res and enter request stress okay request rest dot in okay requestres dot end does the site which today we are going to use for learning purpose okay for learning purpose we'll be using this now if you scroll down this specific site there are so many different apis available to get to get there is a API to post there is a different API to put there is a different API so when I ask you get the data so what is the method that you use you use the get method right to get the data okay to create a new entry to create a new entry what you will be using post okay and to update an existing entry what you will be using to update you will be using something called put okay and to delete an entry you'll be using something called delete okay these are the different varieties that we are going to learn in this video and there are so many other things you can practice on your own once you get to know what are all this okay so let's get started so I hope you have already opened this site on your laptop now let's open your app Studio one by one we will go now the very first activity that we need is http request and for this activity which package we have to install uipath dot web dot API activities so let's drag and drop this activity and here how to use this site okay this is slightly different for example to get the data to get the data it is slightly different and the Json format is also slightly different so there is a lot of learning for you for sure so if you hit on get you need to click on get the moment you click on get there's a URL here so I'm going to hit on Ctrl key and click on it so that it opens in on a new page and I'm going to copy this go back to the studio and paste it okay and then click on somewhere outside okay so the preview you URL got updated now what what the request method is get so I'll simply say get that's all here there is no parameter required because this is a simple one it doesn't look for a parameter just use the API it is going to fetch the data for you and the data would look something like this so let's go back to the studio and I'm going to hit on preview okay so the moment I hit on preview what happened a static data has come in the previous video we have seen we were using random user dot me slash API right so that one was creating random uses every time dynamically this is a static website which gives you a static data [Music] so let me copy paste this static data okay now let's say this is the entire data which has been fetched in the Json in the Json string format right in the Json string format the output would come now if I have to fetch a certain amount of data how to do it let's say I would ask you hey fetch the id8 or fetch the id9 details of id9 or fetch the id10 how do you really pick the data because the Json format is slightly different if you see so how to do that let's see it so first of all we'll open the property of HTTP request we'll go to the output and here in the response content I am going to create a variable which is going to hold the Json string so I'll create a variable I'm going to give it a name called Json string you can give any name that you like to so Json string is the variable which I have given so that is holding the data what are the next activity I should use the next activities deserializing this Json string okay so let's go to activity panel and type deserialize and this is the activity I got it and here the input will become Json string from the above activity and let's configure the output of this activity very important create variable Json object done so this is this much is clear now from the Json object how do I see the data first of all let's view the Json object message box here I will simply say Json object okay um Json [Music] okay all right so here let me increase this font to 120 so that is easy to view all right so Json object is has come now let me run it so what would happen using the API that we have provided it will go to the server it will fetch that starting data and should show you in the message box then we will see how I can extract specific data then we will discuss we'll go through the other set of methods which I have shown in the notepad update put and all that I know how to do it okay [Music] okay see the automation has started [Music] let's wait foreign so you can see the entire data what was I copied pasted into the notepad right the exact entire data has come now if I ask you hey Will the First Data if I ask you pull the first date how do you pull it now tell me I have already explained in lot many videos right how to do that so let me so how will you do it let's say I want to fetch um this one right I want to fetch this one so this remember anywhere you find this kind of a square bracket that means this is a Patty and this array has got multiple data in index number 0 there is a data in index number so these are the multiple indexes so how do I know that so first simply you write Json object and in parenthesis I am going to say [Music] um data okay that is the in the notepad how it is I'm simply writing so if I write data and try to run this [Music] so what would happen because this is an array it's going to pull all the data and show it to me okay give it few seconds all right so now you can see id7 id8 id9 everything is coming let's say if I write a zero what would happen so likewise you need to experiment in case you are not pretty sure the moment you find that square bracket start experimenting the moment I write 0 what would happen right if I write it 0 then it should actually pull the First Data so how you know it by through experimenting you know try to experiment when you see a square bracket that means this data is there in the array format so the moment I am typing 0 in the zeroth index data has appeared the entire data has appeared right so likewise I have shown you how do you fetch the email address how do you fetch all that in the previous video right to extract the data the same formula applies over here okay nothing different so this is all about get okay I will stop it here now let's understand about so we have learned to get okay good now let's under if you want to learn more I have kept almost five videos around that okay so you must utilize those videos in case you would like to there are a lot of learnings but again I will move on to update here how do I update a um sorry how do I create a Content here so create content means you need to post it right you new continue to post so to do that again we'll go back to the URL okay let me close this now for everything there is a separate URL for post again this is separate if I click on post you will see the URL is different so I am going to control and hit on that and I'm going to copy this link I'll go here in the configure HTTP request I'm going to remove the previous one I'm going to paste the new one and hit on a blank space so it gets updated so what I want to do I would like to post it so what is the method I should select post because I would like to post now what would you like like there has to be some data going to the server from uipath Studio there has to be some data going to the server so where do you provide the data for that you need to use the add parameter option okay so how to use the add parameter option it's pretty simple here if you see the moment I hit on post there is an example given there are two parameters it needs name and job so let me provide these two parameters add parameter and I'm going to say name and I'm going to give it a name let's say John and add another parameter and the next one is job so I will say team lead or something like team lead two something like that I know I'm putting a job title so name and job these are the two different parameters that it requires okay so I've given two different data to it now if you hit on preview what would happen this data will go to the server and has been updated with the status quad code two not one you can see the name has been updated you can see the job has been updated and the ID the new ID for that employee got created and there is a created art at what time the entry got created there is a time stamp getting it how it is working so John these are the two data you have provided and server has written four different data name job ID created ad it is returning from you getting a response from the server so what are the status code two not one this is very important one has to know the status code okay so all you do simply type HTTP request status code on Google then you will find couple of websites just open any any one of them and this is two not one right I'm clicking on this link so two not one means created successfully created the request succeeded and a new resource was created as a result in the server a new new entry has been created getting it's a two not one the status code reading the status code is also very important 200 means successfully updated so all these things are there okay if you go back uh what is the meaning of 200 200 means okay the request is succeeded so when when we are getting the data that means the request was successfully retrieved right successful okay uh 200 means Okay 201 means created right two not four minutes no no content when you delete something that data has been deleted no content so all the status will come we are going to see one by one so this much is clear right now hit on OK so what we have done we are trying to update a new entry and we have provided two different data John and team lead two and it should go to the server using this API and using this endpoint and should update so as a response we saw this is actually giving a response of two not one that that means it is creating the data successfully okay now uh it got created now let's say I would like to see um at what time what is the ID for that employee which I am adding John as a team lead as a new employee what is the ID for him Auto auto generated ID so the ID data is there when I click on preview in the ID field right let me copy this to a notepad [Music] and this is there in the ID if I wanted to know the ID how can I retrieve it so to retrieve that ID what I will do I will use the Json object the same same sequence of activities and here instead of because if you see this Json is quite simple in simple format right all I have to do is I have to Simply write ID so Json object copy paste ID okay all right so if I do this it is going to automatically fetch me the ID so let me run it so every time a new ID is getting will be created because uh we are testing this right or not test test API so the ID will be generated this time the ID added is four three seven getting it similar way name job everything you can fetch it created at ID I'm just fetched I just fetched ID so the how to update something should be clear to you right now the next thing that we are going to learn how do you um how do you delete a data or how do you update an existing data right that is something we are going to see so to update again there is a new API so what we will do we'll go back to that uh to update what method I have to use put method update so I'll hit on put I have got this data and I'm going to click on this link by hitting on control I'm going to copy this will go to the studio the same process repeats okay so the link will be slightly different you can see Slash 2 it has written okay and click outside and then this time what is the request method I should choose put put means it is going to update something okay update something post means you are entering entering a new entry you are putting a new entry so here I want to update um so if you see the current data in this one the moment you hit on update uh hit on put what is the existing data Morpheus and job is Xeon resident this is the data currently available so I want to update the name to something else update the job to something else okay so what I'm going to do let me update the name to John and job to team lead to this is what I would like to update to the existing data on the server which is more Fierce it will be changed to John okay so let's see that if I hit on preview what happens so what happened the data has been replaced with Jon and what the job title has been replaced to team lead 2 and updated art these are the three different data and all this data can be viewed Also let's say if I say Json object if I simply say Json object and uh try to execute this I will see the Morpheus engine I mean these are the static data which are available on the server I'm just trying to play with it okay using different methods so what would happen the static data would now change to John and timid and the data has appeared the Json data has appeared okay so this is how you need to just you know understand how things are working and let's say delete so if you hit on delete again there should be a different API for this hit on delete and there is a different API link so let me okay click on this delete and then click on this URL I'm going to copy this and hit on configure and I'm going to paste it over here okay and this time the request method will be delete okay delete and uh what this will do the existing entry so it is not asking to and you know give some kind of a parameter it is not asking you to provide any parameter so what I will do I'll go to so every API has a different so here this is for learning purpose so I am going to delete all the parameters that I had entered it is simply going to delete it okay so if you look at the website it will simply will give you a response called two not four that means it has deleted so if I hit on preview it is giving a response called two not four what is two not four status quo to not form is no content there is no content to send for the request I mean you will not receive any response because the entry has been deleted from the server okay so if you would like to delete something every API will have um its Specific Instructions so in this API for delete it doesn't provide uh the argument for example delete the ID so and so so if you would have given some argument we would have used those arguments to provide an entry and targeted that specific entry but here this is not available that's fine but again you understood how to delete using a specific link using if if there is a parameter needs to be provided you have to provide those parameters and do one delete okay so these are the four different areas that we have learned you can also practice couple of other options available like post get login unsuccessful there are different different options so these are the parameters okay and this is the API use all of this and try to practice as many options available on this link for your learning purpose so thank you guys for watching it going to meet once again in our next content do not forget to give it a comment what did you learn from this video or how was the content for you what else would you like to learn and also ensure you subscribe to my channel and do support me um I need definitely I need your support to grow the channel thank you guys for all the support till date and we are going to meet once again in our next content till then take care bye [Music] thank you
Info
Channel: Automate with Rakesh
Views: 18,137
Rating: undefined out of 5
Keywords: how to call api in uipath, how to automate api in uipath, how to do api calls using uipah rpa tool, api post method in uipath, how do you send a post request in uipath, uipath atpi integration, uipath http request json body, api, rest api
Id: fBMoaoOoxfI
Channel Id: undefined
Length: 19min 10sec (1150 seconds)
Published: Thu Jul 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.