Rest API GET Call using HTTP Client || Validate JSON Response - Rest API Automation - Part-4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
elephants welcome tourists web services automation part 4 so there in the previous session we have seen that ok how to call the get call and how can we send the get request and how exactly we are getting the response in the form of JSON object and different headers we are getting and how to use the HTTP client library so we created our first project ok so today I will tell you that how to automate get API with headers first of all and we will learn that whatever the JSON response we are getting okay how to parse how to validate that particular JSON response how to get the value from the specific JSON response so I have created one very small function utility you can use that particular method and same thing how to validate response by using test chain G assertion because ultimately we have to validate that we are getting 200 response code or not are we getting the correct JSON object or not right so these kind of things we can varied it ok so it's very important because ultimately you are calling the API again you are getting the response but you have to make sure it's your responsibility that you have to make sure that whatever the response you are getting is correct response or not ok guys so that's very important the validation part is very important ok so if I open my clip so far we have seen that ok we have created simple one this get method inside the rest line dot Java class in which what exactly we were doing just a minute just a minute like gestures yeah so in which what exactly guys you are doing over here so far as yesterday we have seen till here that we were calling this particular we were executing this particular HTTP GET call and we were getting one closed HTTP response object and in this particular response object we have a status code then we were having one JSON object that the response and whatever the different response headers are available we were fetching those headers also so three major things okay we were fetching so what I'll do guys simple I'll take this code what I want this particular get method should return only this particular response okay I want to fetch the information status code JSON string and all headers from this particular object I want to do this thing in do okay from my okay in my test case actually not here okay the fetching part I want to do in my test case I want this particular get method should return only closed STP response object that's it so what I'll do from here to here and copy this thing and I mean I just remove this thing and what I'll do inside the gate API door test I will call this method so this get method will return me one closed response object okay so what exactly this get method I will make some changes that this method should return simple I'll try to return this thing okay so whatever we are getting the response s2 DB response I want that this get method should return you this particular response so obviously instead of white I have to write this particular last name because why because this particular get method is a returning what is returning this class name object this class will object reference so obviously the return type of get method will be that last name right simple if the return type is this particular get method is returning a string then we have to write a string over here right if a particular method is returning an integer then we have to write int over here same thing if return type of this particular method is close s to DB response this class name then we activate the class name over here right we are returning classroom class object reference so in that case obviously we have to write class them over here right to simple thing I have done this thing now what I'll do this simple get method will return what see this simple this method will return close HTTP response object so what I'll do this is a close actually responds object okay I'll store over here in this particular reference and this glow response object I will define over here just like we defined here in rest line okay so this is the class name and okay and this clip object I'll define at the class level so that it will be the global variable will be initialized with this the rest line dot get method will call this particular method it will do all these stuff it will return close HTTP response so this get method will return close HTTP response I will store in this particular object reference therefore this reference is again close HTTP response object only so I can store in this particular reference the written right and from this reference inside the test case I am fetching the data like this the status code and Jason string in everything now what I will do after getting this particular status code see this is the street to score actually not like this status code what I'll do I'll put my assertion okay inside my test case I'll put my assertion so what I'll write simple and write assert dot assert equals okay ulcer dot assert equals what are you expecting I am expecting 200 okay and what exactly the actual thing you are getting are getting this status code this interior state to school okay so this assertion class is available here in test in G guys okay in testing G see it asserted from J unit actually so we have to import from destiny okay so uh sir dot I saw T equals I have written that I'm expecting this is actual thing this is actual thing we have to write it reversal yeah like this okay nice so the Sadat assert equals status whatever the status at the right time okay after recording the APA we are getting 200 if it is equal to 200 it means my version validation is passed and if it is it is getting failed simply I will put a message over here that the status code is not 200 something like that if that particular assertion is getting failed then it will show you it will return one message that a status code is not 200 okay so guys what I want I don't want to hard code this particular value this 200 I don't want to hard code so what I want I will I'll go to my base class okay and then I will create one I will create one variable over here let's see public okay public and the tea okay public and I'll write simple like this integer response underscore status underscore code underscore 200 is equal to 200 okay so I will create different response code okay like this let's see 204 okay 500 then let's see 400 let's see 4 4 0 1 error or let's see with 2 0 1 okay and soil maintain over here like this 400 this is my 4 0 1 and this is 2 0 1 right so different response code inside the base class I have written like this ok now what I'll do instead of this inside my test case instead of this 200 can I write like this ok so we will be getting because this is the variable we have defined inside the base class so obviously we can inherit this particular value from the base fields directly so I am expecting this ok so we have removed the hard-coded values from here so tomorrow let's see if you want to change any particular value you just need to come over here in the base class and then change it over it okay so this is a thing that a base class concept the inheritance I'm using over here so a status code I'm expecting this status code so I'm not using any hard-coded value over here so this is the first assertion I have used okay so if you run this program guys okay if this assertion is getting passed then only my test case will be passed see I am getting response code 200 and this 200 is equal to 200 it means my test case is passed so this is the first assertion I have written in this particular test case similarly I can write different assertions for different assertions for other like Jason values also but how to fetch the jason value because you are getting JSON object like this see this is the jason okay if you see the JSON object it's starting from here and this is the response we are getting this is the response we are getting right and if you see this particular response in the pure JSON string so we can go to this jason linked website and then paste your jason response and click on where it adjacent so this is a very odd jason we are getting but how will you get to know that per page is equal to 3 or total is equal to 12 how will you get to know how will you verify that the value of total attribute is equal to 12 or the value of per page is equal to 3 or maybe you know this particular attribute value or maybe inside the data inside a data array we have three different right 1 2 & 3 how will you get to know that okay in data last name is equal to blood and first name is equal to George like this how will you validate that because this is a Jason right this is a JSON object okay so to parse this particular JSON object I have written one utility okay so what I will do see this is a utility it's very simple utility guys easily you can understand simple string manipulation I am using over here and what I will do I will go to eclipse and we can do one thing we can create one util package and you know sounds easy in Java okay I will create one package comm dot Q dot util and inside that total package I will create a class let's see my class name is test you till okay and click on finish and inside this test util class I will copy I mean I paste that particular method what is a method name from here I have to copy okay this is the method now see what is a method this method is get value by Jason path a simple method I have created over here okay this method is having this particular string and this method is returning what this method is returning when JSON object so this JSON object we have to import it from JSON object library the inside my pomerode xml file i have already added this particular JSON library okay guys so this particular json object is coming from this particular library and this JSON array also it's coming from there so we have to import this and all the errors are gone and this response jason we have to create and tell you what we have to do in just a minute so there is what I have written simple one where even I have created this JSON object response JSON object reference I have created okay and simple I am doing some split operation and contains in string manipulation so what exactly this method will do guys this method will contain only one J path we have to pass one spring path we have to pass that what exactly the value you want to fetch okay so what I will do simple nice to see it very carefully it's very easy you just need to use this particular method utility that's it and what I will do this test udel class I'll make it this method is as a static so that I can call call it by a class name and this also I will make it a static so there I can use inside the static method okay now I'll go to get API test and this is the response Jason riff okay we are getting and what I'm doing over here now see it carefully see this is the response we are waiting ways this is a response we are getting I want that what is the value of let's see total or what is the value of maybe per page okay so what I'll do I'll call this particular util method this method get value by Jason path okay so how to call because this method is available in test util and this method is a static so by using test utils last we will contest util dot get value by J path and what is your J path see now there are two types of variable in JSON object guys this is a simple variable one variable name and variable value this is a simple variable name and value but data is not the simple variable data is after data if you see this square bracket it means this data is an array okay this is the JSON array and this is called JSON object this is called JSON object but this is called JSON array because why because after data we have written this square bracket and in area we can store multiple values so in this particular area this is a first set of data so this is a zero at value okay this is a second first value and this is a second value so the three set of data will be stored 0 value first value a second value 0 index first index and second index okay in this particular data array now we will talk about iterate any after sometime but how to get the value of our page to get the value of our page what you have to do very simple copy this per page attribute and as a J path just passed this particular or a page attribute like this okay and get value by j j path will give you one string and let's see what exactly it is returning let's see string s is equal to this and I'm creating this particular value the value of an S let's see what exactly it is returning let's see okay so let's call this a PA okay getting the response and it's throwing some error what is the error to that nullpointerexception well let's see okay so here it is showing some nullpointerexception so maybe some correct J path we have to pass let me check just a minute okay yes so some minor chain what you have to do see is what you have to do by calling this gate value by J path that we have created okay what you have to do here you have to pass but more object a JSON object on which JSON object you want to fetch the value of this particular variable whatever the variable you are passing okay so what I'll do here so this is a response JSON response we are getting over here in this particular object response Jason and pass this Jason respond Jason over here okay so this is the huge just for response we are getting so from this particular jason response then in there jason response we have stored in this particular response JSON object right and from this particular Jason response Jason I want the value of for a page so the value of per page is equal to three right so what I'll do this gate value by J path will get this particular response Jason it will store in this particular obj it will do this particular string operation complete okay logic and then whatever the value you are passing it will give you the exact value so what I'm passing here days I'm passing that I want from this particular response this response Jason is having this complete full response from this particular response I want to get the value of per underscore page so you have to use this per underscore page attribute you have to use and what you have to use slash per underscore page like that okay guys / / underscore page you have to use okay now if you run this program what will happen let's run it and then this get value by J path will give you one a string it will store in this particular object so let's see I am storing in this particular string reference that is let's see per page value okay and I'm printing this particular per page value over here that value of our page is this and I will put one assertion holds and writes in will assert dot assert equals okay our daughters are equals what are you expecting I am expecting see same thing again I think it got imported from J unit okay no so I saw dot also equals what is your actual value so this is my actual value okay and what are you expecting I am expecting three because the per page value is three right so per page value is three I am expecting three so if you run this program let's run it no keep is okay so it's hitting the API see from this particle response I'm terminating it this is the response I'm getting my page value is equal to three so the value of per page is three so from this particular JSON response it fetch the value of this particular per page attribute is equal to 3 so it's returning 3 a very simple utility simple matter you can use in your project to parse the JSON object get value by J path okay and simple you just need to pass from bit JSON response and what exactly the value you want it means I want from this entire JSON response I want the value of per underscore page let you tomorrow you want the value of total so what I'll do simple I will call this particular method again like this okay and let's your total value alight total value is equal to this now I want the value of total okay so I'll pass slash total and and simple write total value of a value of total is whatever a total value we are getting this and we will write one assertion okay for total value also so for different attributes which are important you want to assert you can assert first get the value from the Jason's okay and then assert it assertion that is very important because might be let's see you are expecting 12 total value is 12 but let's see the value is coming 15 the response you are getting fine but the correct response is not that is very important right might be possible that okay you are getting wrong response let you total records are not 12 total record should be 15 or maybe the calculation the total calculation should be 15 but you are getting 12 or 10 you have to validate you are getting the response fine it means the your server is giving you the response but it is a correct response or not it is a correct price as coming from okay indigo dot-com or not that you have to validate properly right so that's why we have to put assertion for the important attribute it's not like the legit tomorrow you have thousand attributes no need to check for thousand attribute but important attributes we have yesterday it's really important okay so that the total value I'm uh starting over here total value should be total value I'm expecting legit twelve so I will write twelve over here okay total value should be 12 so this is the assertion this is a value I am getting for total page total underscore page and this is for simple total attribute I'm getting over here okay per page so in our total page this is for per page okay and this is what totally right so let's see four slash total also it's it should return twelve and then it will validate with twelve simple so let's run it the value per page is three and let's see oh it's giving the matter that expected three but found three why expected three then found see that is all both are fine what is per page value 3 and this per page value is a string and see this three is what right this is a problem this three is an integer that we have written right this three is an integer so you are comparing one string will endear see in this three is integer so that's rich weighing there you are expecting three okay but found three it means we're expecting numeric value but you found three string value right so so this is a string value and this is an integer value so either of them we have to convert it okay so let's see what I will do this whatever the per page value it's coming in the form of string so I will come okay I'll convert into simple I'll write integer dot parseint method is there and then I'll convert this string into okay integer so this will have an integer so this three will be this three particular three will will become an integer value then interior to integer comparison I am doing over here okay guys so remember wrapper class so this is an integer is a per class I have already covered in the Java session and the same thing for this guy also what total value this is a string I'm converting into integer and then come okay comparing with 12 now let's run it okay now see the value of okay for the per page is 3 and the value of total is 12 okay just fine the value of per pages 3 and the total is 12 absolutely fine so we are fetching the value from these single attribute to be okay from this single attribute is there simple pass values you have to pass this utility risk from which response Jason this response Jason object / total / / page if you have thousand attributes you can write the thousand attribute assumption over here like this as simple as that simple assertion you can fetch the value and write the assertion okay so these are for single value assertion ok case single value assertion no now we have to write the assertion for I mean get the value from how will you get the value from JSON array that's important so for JSON array we have the same method will do what exactly JSON array will do for single value it will come inside this particular if partner okay for array value it will come inside this else is part and then we will be using the JSON error utility over here okay so you just need to use this particular method and what I will do over here simple JSON array if you want to pass if you want to fetch the value from JSON array now what do you mean by Jason and see this is the JSON data is not as a single attribute it's not a simple law single attribute it's an array it's an error because this is a square bracket see starting here and CH ending over here this is the error value okay so in this particular array value it's it has three different in index it's zero index first index and second index it means this is the first set of data second set of data and third set of data and this first set of data is starting from this bracket to this okay from this back into this packet the second value and from this back into this particular bracket the third value and then the square bracket is getting closed okay now how do get the value let's see I want to get the value data to last name so how will you get it so to this thing to do this thing what we have to do this we have to write same method we have to call okay I'll tell you how exactly we have to do what it is so what we have to do I will tell you how to get the value from this particular Jason area right so this is a JSON array data is the JSON array what you have to do we have to use the same method get value by jason path get value by j path it's available in des util so test util dot get value by j path okay from this particular response jason from this particular response jason and what is your j path so j path will be I have to start with just like you know we use an XPath just like single slash what is your array my array is like this okay data right this is my any data okay sorry like this you have to use what is your array data and this is an array fine data array okay from which value from okay from which index you want to fetch the value I want to fetch the value from this particular first index this is my first index so this is data 0 okay so data 0 and from this particular data 0 what which attribute you want to get so I want from data 0 I want last name ok data 0 last name like this so I restore in some string variable X E string last name is equal to this okay and similarly from for variable I will create for last name ID avatar and first name okay so last name I want ID I want avital and then first name okay first name and ID is this avatar is this okay data zero I want ID and avatar is this and here I want to use first name okay and I want to use first name like this okay so these four attributes I have fest from data 0 data 0 last name data 0 ID data 0 avatar data 0 first name like this so what exactly do it we'll call this particular method every time from this particular response Jason ok data 0 last name so it will come inside this particular else if part from this particular jason array it will do all those stuff and it will written the exact value it will written the last name is look it will return good ok so let's do it and we will print all these values over here otherwise system dot out dot println or maybe okay let's pretend it last name ok this term dot dot println ID system dot out dot println avatar and system got our 20 length first name okay I am printing all these values ok guys so simple run it ok see guys all these values total per page is ok if you see the output per page s3 fine total value is 12 for a page is 3 total value is 12 and then go to data 0 picked last name value see data 0 blood 1 avatar and George so blood is what blood is the last name you can see that growth is an ox name ID 1 avatar is this one 28 dot jpg and first name is equal to George avatar is equal to this one 28 dot jpg in George right and then similarly you can put 1 assertion also right you can write one assertion also nice simple as symbol is that right this is a very good utility that I have created for you guys you can use this get value badge a path if you want to fetch the single value just pass slash and the value total if you want to fetch the data from I mean the specific value from an array see data is an array why because the square bracket is written so in JSON object I always remember if after the attribute this is the attribute is square bracket is written it means this is an array this is not the normal attribute this is an array attribute listen Eric so be called decision object and this is jason array okay so we can print like that and we can put assertion also you can write assertion like a sword a sword equals what our last name I'm expecting that blood something like that you can write the assertions also very simple right so this is how we are parsing the JSON objects right now similarly you can do with the for headers okay so this is your homework that how will you parse the headers simple so for headers also we are getting this particular value so headers are generally headers we don't varied it but it's still like if you want to check it we are printing on the console and you can put one assertion that Assad not assert equals this particular head is like this or not simple okay so we are printing all the all the headers value over here so you can write where assertion for all the headers also for the response headers generally we don't do that but you can do it as a practice point of view how will you validate the headers okay and so this is the second thing that we have covered that this thing how to varied it response by using test in G assertion okay we are passing that JSON response object also the last two points we have covered we are parsing this particular JSON response object this is the JSON response object we are parsing okay different objects these are the two of their this is a JSON object and this is a JSON array two types of attributes are there in Jason only two types either it is Jason value I mean Jason object or JSON array that's it okay now the last thing is that how to automate get API with headers nice it's very simple how to automate get APA with headers okay so what do you have to do ways okay so I will tell you one simple thing that inside this rest client what do you have to do okay this is the method this is a simple get method and we are passing only one URL over here okay now how will you validate that with the headers sometime what happens at okay we have to call the get method and we have to pass the headers also okay so if you see this postman we have seen that we are sending this particular request okay this is the request and sometimes we see that okay we have to pass authentication key username password also remember some headers in your project might be you have to pass okay let's see by default headers if you are passing when JSON object the one default header will be like this content type is equal to application Jason this header will be compulsory if you are using okay any request okay so this is a request header okay guys so this is a request method this is a request to URL and this is a request method so how will you send the request get API with a particular header okay so it's very simple what you have to do nothing simple to go to your Eclipse and just copy this method so this is the get method I'll write without headers okay now I will create just a minute okay I will create the same method only a couple of lines you have to add I'll write get method with headers okay simple same get method I'll overload this method by passing two parameters so one string URL and another is thing what do you have to do you have to pass I'll tell you guys what you have to do you have to pass one hash map okay so the body min the hashmap hash map means an object which stores the value on the basis of key n value so what I'll consider that okay this is the header this is the key and this is the value okay this is the key and this is the value right so what I'll do this particular method shooter okay except one URL okay just like this along with okay we have to pass one header a map also so how to pass the header map simple I will create one hashknife object it should accept one hash map object like this which should be key should be in a string and the value should be in a string like this okay you like this just a minute okay so this method is starting here ending here starting here ending here okay and this is the this okay and what I'll do is this particular hash map okay this particular hash map I will pass from by calling this particular market and this hash map I will be using like this so I'll create one hash map object over here like ash method okay this is hash map and hash map object and this hash map along with the request somewhere I have to exist so how to add just the hash map so after getting the URL that you are preparing this HTTP GET to URL before execution okay guys before execution what you have to write before this particular execute the request you have to add the header also just like in postman what we do this is the URL so before clicking once end we have to add this particular header also right in postman automatically this particular header usually added but let's see you have let's see another five or ten headers some time authentication token or session key or authentication key or username or password okay so user name and the password value I mean username username value like this you have to pass okay guys you can click on this bulk edit and other another header header headers like this let's see user name okay : let's see test password : test one two three okay odd token something like this is equal to 1 2 3 4 like this ok so these are the different C headers you have created content type equal to this username equal to this password equal to this authentication token is equal to this but who will provide this information the developers will give you ok that ok this is the authentication this is the password username let's you are working in Amazon so we our username will be test ad read amazon.com and your password so that you only in your network you only can access this particular API so they although this a page online available so anyone can use that but if you're working in a company ok and it's a very confidential API so obviously you need username password or some token then only you can access it so along with the request in the form of headers you have to pass this information that your username password or something like that right so so how to add this header with the center ok get requests so sometimes these are the get some get requests are without headers ok some get request her without headers in that case you can use this method but with some headers you have to use this particular method that you have to pass ok the header hash map also one map which contains all the headers ok now what we have to do with this particular hash map ok guys with this particular hash map what you have to do okay I will tell you one thing just a minute I have one thing ok guys so what do you have to do let's see this hash map I have written this is my header map instead of I'll give some proper name header map this header map ok is available in the form of key and when you pay for mine let see I have it I have pass around 2 to 3 map ok 2 to 3 headers so I have to iterate it now see it will be little complex for you guys I totally understand but guys you have to understand ok you have to practice even I have practice a lot so that that's why I remember all these things so you have to use one entry okay map dot entry key sir you have to use like this okay and repeat like not like this okay map dot entry okay what kind of entry both are a string type string comma string okay map dot entry I will create the odd one object of map door enter let's see my object name is entry I'm starting my for loop like this and this entry will be part of your this header map whatever the header map you are passing this header map dot okay entry set method is there okay and reset like this okay and now what we have to do with this HTTP GET request HTTP GET okay dot we have a method add header method is there simple add header and what is your header value from this particular entries entry dot get tricky comma and entry dot you get value simple so this is the code you have to enter okay for whatever the header map you are passing just okay you have to iterate it by using the for loop so this is a special for loop I have used that okay for it like for I have created one map okay dot entry this is an entry reference and a my trading on this particular entry set this entry set is coming from this header map and I'm adding the header one by one so if you are passing five headers then five address will be added over here with this particular HTTP GET request and once now this has to be get request having two things this HTTP GET request is having this particular URL and this particular header also for this particular see like this this particular URL as well as these headers also okay and and the rest of the code will remain same like this and it will return this so this is get method with headers and this is a get method without headers so I have overloaded the method this get method is having only one URL one parameter this get method is having two parameters one is header map another one is a string URL now how to use this so simple I will create another let's see method at the rate test method okay this at the rate test method get API test let's you'll write with headers okay so get URL is fine get URL is absolutely fine and what exactly it will do this rest client will call this get method okay but before that guys what you have to do before that you have to create one map ok the map of header so what I'll do and then I'll call this particular get method so right now as we are calling this method but we have to call this method we have to pass one header map it means they have to pass one hash map object which contains key as a string and value as a string okay so what I'll do I'll create one hash map over here the simple I'll write simple one hash map both the key is the string and value is also string and let's see and write the name is header map is equal to new hash map key will be string value will be string like this simple hash map object I have created this is my object name sorry Isis okay and this header map dot what method is there simple dot put matter is there what is the key this is the key content type is the key content type okay so this is the string so content type what is a value application jason is the value okay although these are the dummy one if you send with all these dummy username password it will not return anything it to see invalid token ID and all those stuff so I don't want to use all these things because this is a dummy one I have to pass I have passed this is the only one correct header we have in your application maybe the developers they might give you couple of headers so in that case you have to put all the values over here like hashmap not put user name and the user name value hashmap do not put password and password value okay like this so I'll just write for you for your reference okay like this guys let's see for it will be like this use user name and let's say username is test same thing for password password is let's see test one two three or maybe our user name is test at the rate amazon.com like this same thing for authentication token also if you want to add simple write like simple de auth token and your token is let's see 1 2 3 4 5 ok so these are the different maps you have to provide different headers you have to provide in the form of map but if you are using JSON concept your request is Jason this is a compulsory for all the request application slash Jason content type should be like this if you are using XML then it will be application slash XML okay if you communicating with the API in the form of XML that will be slash X in it so I don't need this these three things this is just for your reference I'm just commenting so we have an one hash map having one value one header value and what we have to do this header map you have to pass along with this request get comma this ok now the second method will be called it means this particular method will be called it will create the HTTP GET request with this URL it will add by using the for loop along in this particular certificate we are adding the single header the content type Hydra this particular content type Hydra will be added over here and then it will execute the request with the headers ok earlier what exactly you are doing guys we've gotten along ok we were not passing like this I mean even passing any headers pick me it was like that we were getting the response like this but if you're passing content I'm with application Jason also okay in that case also we are getting the response but this is a this is not compulsory but it will be the default header will be there the default header content I will be there always it doesn't matter you are passing or not okay but sometimes some other important headers these are the compulsory headers we have to pass sometimes okay in that case you have to use this method you get okay with headers now okay and simple and although the status code and everything will remain same so if you run this particular let's see I'll write two names this first test case method name is get API test without headers okay and I'll write the priority also the three priority is equal to one and this is my second test case priority is equal to two okay twenty is equal to two and simple if you run both the programs let's see we will see the output so one by one both the test cases will be executed see both the test kitchens got passed with headers end without header right both the test kit is got passed get APA without headers and get APA with headers simple and if you see the console okay we are getting both the response see this is the second response and this is the first respond from the first with without hydrogen with with headers right so APA testing is very very fast this is the biggest advantage that okay there is no UI there is no browser no x4 the shoes no properties no object nothing no CSS selector or a dynamic XPath and explicitly weight implicitly weight nothing it's a pure Java programming but it's little bit tough it's a little bit tough race it's not that straightforward just like selenium that we know the driver not find element by dot XPath and all those stuff okay there is no UI there is no interaction what is happening everything is available in the form of web services and on top of that developers they create the UI so that it will it can become user friendly for you guys but if you are a technical engineer or automation engineer back in engineer back in automation guide you should know about all these things things if you are doing such kind of stuff I'm giving you guarantee you can crack any interviews and there is amazing demand selenium with back-end front-end plus back-end ok so there will be lot of lot of opportunities if you can learn these things this is the first example I mean one of the example I have given you get one in the next session I'll tell you how to do the post call put and delete ones so if you are good in all these three operations get put post and delete and some other information about the REST API and the architecture and web services then you can correct the interviews easily you can cry and the interviews okay and these are the libraries you have to always I'll share the libraries this is the library it can this particular ok these two methods can be used for any get call now you can hit any get one ways and this test duty library to pass a JSON object simple just pass the slash whatever the value of an attribute value simple path slash attribute you will get the value if it is an array you have to pass like this okay like this data array from 0 to array value give me this attribute name simple so okay face so that's all for in this particular session so these three things we have covered the gate one in the next session we will see that ok how to do the post call okay how to do the post call with headers and without headers same thing put and delete ok and then we will see some examples with xml's so currently we have seen Jason know we can see some XML examples also ok and yeah that's it for today ok guys so if you really like the video please share the videos with others your friends and everyone and you can use the same concept in your project also means please subscribe to the channel lot of ideas are coming guys so please subscribe to the channel like the video and share the video and put your comments if you have any query definitely I will try to reply over there but guys don't scare with API automation it looks a little scary because a lot of Java coding skills you need but it's very simple guys please try to practice right in the coal by your own I'm sure ok you can easily easily you can write it ok so thank you so much please subscribe our channel guys thanks a lot
Info
Channel: Naveen AutomationLabs
Views: 92,383
Rating: undefined out of 5
Keywords: API, WebServices, RestClient, POSTMAN, JSON, GET API, POST API, java rest client post example, apache httpclient post example, java call rest api example, java rest client json, java rest client example with authentication, httpclient post json example java, java post json data to url, java http get request json, Naveen AutomationLabs, REST API concepts and examples, HTTP Get and Post request in Java, JSON Web Service using HttpClient and HttpPost, JSON PARSER, validate json
Id: mcUpHffY47A
Channel Id: undefined
Length: 50min 25sec (3025 seconds)
Published: Wed Oct 11 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.