How to Perform Post, Delete, Put Method in Rest Assured- API Testing-

Поділитися
Вставка
  • Опубліковано 21 жов 2024

КОМЕНТАРІ • 160

  • @RameshKumar-qm3yf
    @RameshKumar-qm3yf 5 років тому +5

    Hi Mukesh, Thank you for teaching us RestAssured API. You are so kindhearted by taking your precious time and teaching us for free. Be Blessed by Diving power.

    • @Mukeshotwani
      @Mukeshotwani  5 років тому +1

      Thank you so much Ramesh, your comment made my day.

  • @siddeshwarmithbavkar4232
    @siddeshwarmithbavkar4232 6 років тому +1

    Best video for beginners in API automation!

  • @seemamotwani8451
    @seemamotwani8451 3 роки тому +1

    Explained in very simple and easy way. Thanks

  • @YuTuBeKuMiBoY
    @YuTuBeKuMiBoY 5 років тому +2

    you are the greatest man ever, i want to be like you one day.

    • @Mukeshotwani
      @Mukeshotwani  5 років тому +1

      Yes you will be buddy, I can guide you whenever you need my help. Feel free to reach out to me for any issue.

  • @venkat-JAKKEPALLI
    @venkat-JAKKEPALLI 3 роки тому +3

    Really helpful.. Thanks for clear explanation mukesh..

  • @MANJUBALASAHANA
    @MANJUBALASAHANA 6 років тому +2

    Thanks so much Mukesh!! so much easy to follow.

  • @desertstar7664
    @desertstar7664 5 років тому +1

    Cool tutorial, very straight forward to follow. Thanks Mukesh !

  • @asmarazaq9122
    @asmarazaq9122 4 роки тому +2

    Mukesh your videos are very informative indeed

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +1

      Thank you Asma 😀 and I am going to try your paneer recipe from your channel.

    • @asmarazaq9122
      @asmarazaq9122 4 роки тому +1

      thts so nice of you

  • @abhilashpulimamidi1742
    @abhilashpulimamidi1742 6 років тому +1

    Hey Mukesh , thanks for making videos on REST.
    I’ve small doubt.
    What’s the difference between Rest assured and Rest using http client
    . And which method of approach is easy and important/useful for building a framework .

  • @sudiptamohanty8385
    @sudiptamohanty8385 3 роки тому +1

    Thankyou so much. gone through so many tutorials finnaly this worked thankyou so much.

  • @kushanchoudhury1942
    @kushanchoudhury1942 6 років тому +1

    Wonderful...please share some more videos on Rest API...thanks Mukesh!! :)

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Sure Kushan will upload after 9 feb

  • @khushbookapoor1968
    @khushbookapoor1968 6 років тому +1

    Thanku so much mukesh for posting this video..I will look into this.Really thanks

    • @Mukeshotwani
      @Mukeshotwani  6 років тому +1

      Most welcome Khusbhoo

    • @MrBalavenkatesh
      @MrBalavenkatesh 6 років тому

      Hi Mukesh. I am getting io.restassured.internal.RequestSpecificationImpl$RestAssuredHttpBuilder parseResponse
      WARNING: Could not parse content-type: Response does not have a content-type header.. Can you please help me how can i overcome this error?

  • @sgstuff3981
    @sgstuff3981 6 років тому

    Thanks Mukesh, you have explained the concepts in more easy way. Sometimes in API testing ,server asked for client authentication before proceeding for actual api testing, can u pls explain how to automate it using REST Assured

  • @shellysharma4397
    @shellysharma4397 6 років тому +1

    Thanks a lot for posting this. AWESOME VIDEO.

  • @KiranKumar-jj9vu
    @KiranKumar-jj9vu 6 років тому

    Hi Mukesh, Your teaching are simple & more valuable. Appreciate your efforts.
    For big payload, you said, POJO, File Models. May I know when can we expect those videos. Thank you!

  • @AbhishekKumar-no8xe
    @AbhishekKumar-no8xe 6 років тому +2

    Excellent work Mukesh. I learned the selenium and now Rest API from your tutorial. Well Explained ! Have a question from what I read somewhere that REST is stateless, therefore the SERVER has no state (or session data). If there is no Session Data then how REST Client can "Cache" it and utilize it again(If triggered to same endpoint)?

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Hi Abhishek good question.. When you send request to server and server process your request then you will get sessionid,cookies and other information which you can use for further calls.

    • @AbhishekKumar-no8xe
      @AbhishekKumar-no8xe 6 років тому

      Mukesh otwani Thank you for the reply. I guess we get these details in response from the REST server. If not then whats the key difference.
      Correct me if I am wrong.

  • @kushanchoudhury1942
    @kushanchoudhury1942 6 років тому

    Hi Mukesh,
    Please share some more videos on Rest API.Awaiting for your latest videos eagerly.

  • @asif.mammadov
    @asif.mammadov 6 років тому

    Hi Mukesh. Thank you for the video! I am very new to RestAssured and I want to use it to automate the API service I am developing. From my understanding the framework does a live testing against up and running API service. Is there a way/approach to use RestAssured testing during build time ? Similar to how JUnit tests run when you build your project using maven. If that is not the case, I was wondering how people use RestAssured in production environment. I would love to hear your thoughts!

  • @vittal89
    @vittal89 4 роки тому +1

    Hello Mukesh,
    Consider an example of Creating a User , Reading , Updating and Delete the User Information.
    On Creating the User , I will be getting a unique ID dynamically as a repsonse for the user which will be used for the consequent Read,Update and Delete request.
    My question is on having a data file with the details , I want to perform these operations in sequence by using the dynamically created response as a input value in my consecutive request for a single sequence CRUD operation and for the bulk CRUD operation.
    Is this possible in Rest Assured.

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому

      HI VIcky, yes it is possible with RestAssured. If you have any sample API then I can record video and send you.
      Approach 1- This is called api chaining where one API will pass data to another API. I have show similar example in this video.ua-cam.com/video/p81DCbuP2qk/v-deo.html

  • @nithyadevabhaktuni6712
    @nithyadevabhaktuni6712 3 роки тому +1

    Hi, Can i know how to record a value from the response body and parameterize it to use it in next API. [Selenium ]

  • @utpalkumar3
    @utpalkumar3 5 років тому

    Hey @Mukesh, don't you think "json.simple" dependency is little old (Last released in 2012). is it still in used? or any new alternative is there so we can use that. Videos are great by the way. Thanks

  • @JitendraKumar-lr3vq
    @JitendraKumar-lr3vq 5 років тому

    hi mukesh , i am a regular follower of your videos,your videos are very easy to learn and interactive. could you please make video on gradle installation and integrating gradle with jenkins. gradle is used nowadays frequently please make vdeo on gradle.

  • @rahulhonashetty2120
    @rahulhonashetty2120 3 роки тому

    Hi Mukesh I think PUT http method also create additional load on server. Because if we want to edit some resource which is not available in server than PUT will first act as POST than act as PATCH. (i.e., It will create resource and than edit the resource)
    correct me if i am wrong

  • @15nupursingh
    @15nupursingh 4 роки тому +3

    Hi..do we have session of api automation with cucumber

  • @santosh830
    @santosh830 6 років тому

    I don’t understand why there is a dislike for this video☺️

  • @santosh830
    @santosh830 6 років тому

    Mukesh, does geckodriver work with firefox version 58.if so which version should I use for the gecko driver. Thanks for your effort in training us .

  • @maheedharkolipakula9222
    @maheedharkolipakula9222 4 роки тому +1

    Tq Mukesh sir . explanation is soo nice

  • @stephenshinde3502
    @stephenshinde3502 6 років тому

    Hi Mukesh, Thanks for making videos on this topic
    I have one doubt regarding PUT method
    {
    "device": {
    "appVersion": "1",
    "authorization": "Basic ",
    "customerId": "12",
    "deviceId": "123",
    "deviceName": "Samsung SM-N900",
    "deviceType": "1",
    "X_Per": "zZD/h",
    "isPassword": "0",
    "language": "1",
    }
    }
    How to write above Response into JSON formate

  • @krishnasamy3967
    @krishnasamy3967 5 років тому

    hi @Mukesh - How to make series of API calls from a base API using response data from the base API. Eg: API1 is base API, the response data from API1 will be used as input for API2, API3 and those API`s will be called in parallel or series. Pls advise.

  • @kellykessler3294
    @kellykessler3294 6 років тому

    Hi Mukesh,
    Again tanks, I think we should avoid double citation("") while trying to post any int value like id, am I right ?

  • @bhadmusautomates
    @bhadmusautomates 6 років тому

    Hi Mukesh,
    I have a challenge. I have some apis to automate. The rest of the APIs depend on an access token response generated from a POST method.
    1. How do I get this access token from the response?
    2. How do I use this access token in other POST and GET methods using java and REST-assured?
    This is urgent please

  • @VamsiKrishna-og1zu
    @VamsiKrishna-og1zu 6 років тому

    Hi Mukesh, nice video. Any one of your other videos covering how to fetch response in run time?

  • @abhaypratapsingh4526
    @abhaypratapsingh4526 4 роки тому

    Hi @mukesh
    Do you have any video with post api having complex body means jaon inside jaon type body ,how we need to put for those body

  • @theharshaankalgi
    @theharshaankalgi 3 роки тому +1

    Awesome Brother, God Bless.

  • @saquibhelal7477
    @saquibhelal7477 5 років тому +1

    Can you tell why here we use RestAssured.given()
    and can you please some more video on Rest Assured Api Testing

  • @abubakarshaik4688
    @abubakarshaik4688 5 років тому

    Hi Mukesh thank you for sharing your knowledge ... Please make video how to get data specific data in json body

  • @gasparottogui
    @gasparottogui 6 років тому

    Great video, thanks Mukesh.

  • @sharmilaraj6476
    @sharmilaraj6476 5 років тому +1

    Hi Mukesh, Thanks for Sharing this video!.I m getting "Failed to parse Json document" when i use Json object in my POST method.COuld you please help!

    • @Mukeshotwani
      @Mukeshotwani  5 років тому

      Hi Sharmila, it means payload is not proper. JSONObject will only work when you have valid payload.

  • @charubhardwaj8059
    @charubhardwaj8059 5 років тому

    Hi mukesh ,
    How to send below body request in json put
    {"service":"pentest_appsec",
    "ticketing_system":"jira",
    "requester":"chbhardw",
    "issues":{
    "service_queue":[
    {
    "product":270,
    "queue":"ABC"
    }
    ],
    "customfield_21701":"bhsingha",
    "customfield_21700" : "chbhardw",
    "issuetype":"Bug",
    "splc_priority":"R1",
    "summary":"test",
    "fixVersions" :"2019-Q2",
    "duedate":"2019-12-16"
    }
    }
    i can use any other

  • @appupruthvi8558
    @appupruthvi8558 6 років тому +1

    Hi Mukesh, did you posted any video related to oauth handling in rest assured. If yes, can you please give us the video link.

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Not Posted yet.. Pruthvi

    • @appupruthvi8558
      @appupruthvi8558 6 років тому

      Hi Mukesh, Thanks for your replay. When are u planning to post the same?

  • @rajeevkommana1990
    @rajeevkommana1990 6 років тому +1

    thanks so much Mukesh

  • @mandarthamke9779
    @mandarthamke9779 3 роки тому

    @mukesh
    I have some doubt on api automation
    I need to automate api which hosted on AWS Mock service
    But not exactly getting proper solution
    But same api I can automate when it is hosted on developer local machine
    Pls guide
    Or any example that you can share

  • @prabakarani7863
    @prabakarani7863 5 років тому

    Hi mukesh
    Please explain how to log/export the response/request details to the external files?

  • @Deliquesent
    @Deliquesent 4 роки тому +1

    Hi, could you please share the link for all topics in API testing covered in your tutorial?

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому

      Hi Sakshi, here is the link ua-cam.com/video/yzY-5POP6xY/v-deo.html

  • @krishnapandit6065
    @krishnapandit6065 6 років тому

    Hi Mukesh ur videos was very helpful, Can u make video for Multi-part form data too Thanks

  • @oneplanet007
    @oneplanet007 6 років тому +1

    I appreciate to visiting on your channel now I am following you I am still beiggenr tester if I getting bother I will ask you please guide me Mukesh Bhai

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Anytime bro. Please send all queries to mukeshotwani@learn-automation.com

  • @swapnilnagtilak101
    @swapnilnagtilak101 6 років тому

    Hello sir,can u make video on agile methodologies.actual o got lots of video related ti that but not getting proper concept of agile.so plzz can you make video on that also

  • @ankitshrivastava1772
    @ankitshrivastava1772 4 роки тому +1

    Hello Mukesh, How to pass Params in any GET or POST call, as we pass in the Postman . Please help.

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +1

      Sure Ankit, I will record video on this. In the meanwhile you can pass parameter using below post www.baeldung.com/rest-assured-header-cookie-parameter

  • @akankshadubey4937
    @akankshadubey4937 2 роки тому

    Hi Mukesh, I am unable to use JSONObject. it's simply not accepting it.

  • @shreyasb.s3819
    @shreyasb.s3819 6 років тому +1

    Thanks a lot Mukesh

  • @LifeinSoBo
    @LifeinSoBo 4 роки тому +1

    Put and POST operations should go together always ?

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +1

      Hi Soma no its not mandatory because post and put both serve different purpose.
      Post- will create new resource in server like create a tweet, post or story whereas put will update the existing resource on server like change or update the description of uploaded photo, post or story.

    • @raunaqt90
      @raunaqt90 4 роки тому +1

      @@Mukeshotwani if we consider DB. put = update and post = insert.

  • @ashishkumarmishra2346
    @ashishkumarmishra2346 4 роки тому

    Hi Mukesh...After updating data using the PUT method how can we validate whether data is updated or not? Like you updated the author to "Mukesh Otwani" so how to validate from response? Aprt from status code..

  • @AlokKumar-km6pi
    @AlokKumar-km6pi 5 років тому

    What if I need to send different data multiple time ?....Like for first iteration i want to post name as "Alok" and for next "Rahu'"? Can we get the data from excel sheet ?

  • @MalluManish
    @MalluManish 9 місяців тому

    Guru i am following as per your guidlines but i dont no where i am making mistaking ,i am getting this error "C:\Users\Mallukinnis>node -v
    v20.10.0
    C:\Users\Mallukinnis>npm -v
    10.2.5
    C:\Users\Mallukinnis>npx -v
    10.2.5
    C:\Users\Mallukinnis>npm install -g json-server
    changed 55 packages in 6s
    15 packages are looking for funding
    run `npm fund` for details
    C:\Users\Mallukinnis>json-server --watch db.json
    'json-server' is not recognized as an internal or external command,
    operable program or batch file.
    sir where i need to make changes ...can you make video on this because many people getting the same error Guru.

  • @shreerangakv7183
    @shreerangakv7183 6 років тому

    Hi Mukesh, my API only accepts " x-www-form-urlencoded" body only , but i am not getting how to send the body in that format particularly using unirest please help

  • @tarikgulsever5191
    @tarikgulsever5191 4 роки тому +1

    great explanation, how about using object mapper from jackson library .

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +1

      Hi Tarik, yes I have used in this video ua-cam.com/video/yzY-5POP6xY/v-deo.html

  • @LifeinSoBo
    @LifeinSoBo 4 роки тому

    Hi Mukesh, how to filter data we fetch ?

  • @xits
    @xits 3 роки тому

    How could I validate if parameter field "title" is Null (empty) or not ?

  • @shanjaynithin2388
    @shanjaynithin2388 4 роки тому +1

    Hi Mukesh,
    I am getting the following exception. Kindly help.
    java.lang.IllegalArgumentException: Don't know how to encode {"author":"api testing","id":"30","title":"selenium"} as a byte stream.
    Please use EncoderConfig (EncoderConfig#encodeContentTypeAs) to specify how to serialize data for this content-type.
    For example: "given().config(RestAssured.config().encoderConfig(encoderConfig().encodeContentTypeAs("applicaton/json", ContentType.TEXT))). .."
    at io.restassured.internal.http.EncoderRegistry.encodeStream(EncoderRegistry.java:132)

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому

      Hi Shanjay, please share your code then I can guide.

    • @shanjaynithin2388
      @shanjaynithin2388 4 роки тому

      @@Mukeshotwani Hi Mukesh,
      Thank you so much for replying. I have used the same code used in the video. But still I get the error.

  • @manishayadav1877
    @manishayadav1877 5 років тому

    Mukesh otwani plz help me...I need it help in one post method I needs it post data and post inside another table how to do it plz reply.

  • @prachijoshiporwal3353
    @prachijoshiporwal3353 5 років тому

    How we can send the request body through rest assured if its raw and text?? Not given contenttype in header
    for me its giving me 400 bad request because request is going null if i am simply reading request body from textfile.
    jsonobject wont work here

  • @shramanaroy7179
    @shramanaroy7179 4 роки тому

    Hi Mukesh,
    For me it is failing saying Connection refused...please help

  • @jayakumarnachimuthu6224
    @jayakumarnachimuthu6224 6 років тому +1

    Nice explanation

  • @vanikethineedi2854
    @vanikethineedi2854 6 років тому

    Thank you mukesh..

  • @srinivasanm9522
    @srinivasanm9522 5 років тому +1

    Hi Mukesh, how to logon 3rd party urls in html page? for example irctc.co.in, paytm, etc.. How to send post the username&password then submit, will go to destination link what we give in html page?
    Kindly guide me to achieve this.

    • @Mukeshotwani
      @Mukeshotwani  5 років тому

      Hi Srini you need to get their official API's then you can make all API calls.

  • @sauravmahata2401
    @sauravmahata2401 6 років тому +1

    json-server --watch db.json
    says
    'json-server' is not recognized as an internal or external command,
    operable program or batch file.
    what to do?

  • @SunnyKumar-pw9ny
    @SunnyKumar-pw9ny 4 роки тому

    Sir you are amazing.

  • @sudhanshukumar9441
    @sudhanshukumar9441 4 роки тому

    Hi Mukesh,
    I am getting following exception while sending POST request:
    java.lang.IllegalArgumentException: Don't know how to encode {"author":"learn","id":"28","title":"selenium"} as a byte stream.
    Please use EncoderConfig (EncoderConfig#encodeContentTypeAs) to specify how to serialize data for this content-type.
    For example: "given().config(RestAssured.config().encoderConfig(encoderConfig().encodeContentTypeAs("application-json", ContentType.TEXT))). .."
    Code :
    public class Post_Put_DeleteExample {

    @Test

    public void test1() {


    RequestSpecification request=RestAssured.given();

    request.header("Content-Type","application-json");

    JSONObject json=new JSONObject();
    json.put("id", "28");
    json.put("title", "selenium");
    json.put("author", "learn");

    request.body(json.toJSONString());

    Response response=request.post("localhost:3000/posts/");

    int code=response.getStatusCode();

    Assert.assertEquals(code, 201);
    }


    }
    Could you please help.
    Regards,
    Sudhanshu

  • @qeshquddus2709
    @qeshquddus2709 5 років тому

    Do you have a video how to automate Rest API on Cucumber BDD?

  • @sheelasahoo4212
    @sheelasahoo4212 6 років тому +1

    Hi Mukesh,Request you to please help me on this issue: "java.lang.IllegalArgumentException: Don't know how to encode {"author":"Sahoo","id":"22","title":"json-server21"} as a byte stream.
    Please use EncoderConfig (EncoderConfig#encodeContentTypeAs) to specify how to serialize data for this content-type.
    For example: "given().config(RestAssured.config().encoderConfig(encoderConfig().encodeContentTypeAs("application/jason", ContentType.TEXT))). ..""
    the above issue occurs when i Perform POST and PUT.

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Hi Sheela, What is your exact requirement?

  • @gagangill8831
    @gagangill8831 4 роки тому +1

    thanks Bro, it worked.

  • @amitbhardwaj7824
    @amitbhardwaj7824 4 роки тому +1

    cool video keep uploading

  • @GabrielMutis-fk3jc
    @GabrielMutis-fk3jc 6 років тому

    Hi i'm trying to upload a csv file using rest assured O_O but i don't really know how to do it...when i'm doing it manually in swagger the curl displays it like this "file=@nameOfFileIwantToUpload.csv;type=application/vnd.ms-excel" -F "fileFormat="csv""
    My attempt was to use the multiPart() method and inside to use new File(pathToMyFile) but i'm getting code 400...

  • @vishalregister655
    @vishalregister655 3 роки тому +1

    How can I find toJSONString method but it is showing only toString method.

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому

      Hi Vishal, which are dependency you are using and which version?

    • @vishalregister655
      @vishalregister655 3 роки тому

      @@Mukeshotwani Hello, I am using maven dependency and using latest version 4.3.3..

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому +1

      Try adding below dependency
      io.rest-assured
      json-path
      4.3.3

    • @vishalregister655
      @vishalregister655 3 роки тому +2

      @@Mukeshotwani I am using same dependency.....but now problem is solved by using bdd process:: request=RestAssured.given().contentType(ContentType.JSON);
      request.when().body(json.toString());

    • @swatishilpa1136
      @swatishilpa1136 3 роки тому +2

      @@vishalregister655 @mukesh Otwani - Did you get any solution for this problem?

  • @ganeshchanti3841
    @ganeshchanti3841 6 років тому +2

    Hii mukes still any videos are there to learn

    • @ganeshchanti3841
      @ganeshchanti3841 6 років тому

      for automation

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Hi Ganesh,
      Yes there is so much to cover in API testing. check out the below link for list of topics
      learn-automation.com/api-testing-using-rest-assured-online-training/

  • @sharanyabhiram9242
    @sharanyabhiram9242 4 роки тому +1

    Did anyone face this kind of issue..
    When I am trying to create my post request using
    {"Id":"4",
    "title":"book",
    "author":"Chethan"}
    My response is showing in the below format
    {
    "title":"book",
    "Id":"4",
    "author":"Chethan"}
    I want my response same as the request I creaated.

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +1

      Hi Sharanya, order of fields does not matter here.

    • @amangiri6429
      @amangiri6429 2 роки тому

      @@Mukeshotwani noted Thanks ! Actually , I was also facing the same issue but its resolved

  • @jajatikesharisahoo8628
    @jajatikesharisahoo8628 6 років тому +1

    great dude..........

  • @shubhrajitmohapatra2191
    @shubhrajitmohapatra2191 6 років тому

    Hi Mukesh
    I have doubt that selenium can automate shop.polymer-project.org/ this site or not.
    Please help me to solve because I'm try a lot of time but its not working by selenium.

    • @MrMadhur18
      @MrMadhur18 6 років тому

      yes selenium can do this....

  • @AbhishekSingh-xy7kf
    @AbhishekSingh-xy7kf 6 років тому +1

    Hello Mukesh coding is simple and well understood but this is hard coded method we have to write entire set of codes everytime can you please instruct how to parametrize this method , Url i can but to supply body how i will do that. Will be waiting for your response.

    • @Mukeshotwani
      @Mukeshotwani  6 років тому +1

      Hi Abhishek,
      Yes, we need to build the framework for the same. I have planned videos for the same will upload soon.
      Note- We have to use POJO Class for the same.

    • @AbhishekSingh-xy7kf
      @AbhishekSingh-xy7kf 6 років тому +2

      Thanks Mukesh will be waiting for the video. I have learnt entire selenium from your videos Great work Keep it up.

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Thanks Abhi : )

  • @kellykessler3294
    @kellykessler3294 6 років тому +1

    Thanks for your effort, you are doing well but I think it's time to flip to IntelliJ IDEA

  • @engineers-blog
    @engineers-blog 5 років тому +1

    Sir i m getting response as "500" plz help me

    • @Mukeshotwani
      @Mukeshotwani  5 років тому

      For which scenario? You are getting 500 ?

    • @engineers-blog
      @engineers-blog 5 років тому

      @@Mukeshotwani post()

    • @engineers-blog
      @engineers-blog 5 років тому +1

      here is the code
      package Lifafa_Automation.Giftcard;
      import org.json.simple.JSONObject;
      import org.testng.annotations.Test;
      import io.restassured.RestAssured;
      import io.restassured.response.Response;
      import io.restassured.specification.RequestSpecification;
      public class GC_API {
      @Test
      public void test() {
      RequestSpecification request = RestAssured.given();
      request.header("Content-Type", "application/json");
      JSONObject jsonObject=new JSONObject();
      jsonObject.put("paymentMode", "lgc");
      jsonObject.put("lgcNumber", "7500037427390449");//send array type data
      request.body(jsonObject.toJSONString());
      Response post = request.post("pre-payment-engine.goomo.team:443/payment-engine/api/v1.0.0/giftcard/vg-query-action");
      int statusCode = post.statusCode();
      System.out.println("Status code ="+statusCode);
      //Assert.assertEquals(statusCode, 201);
      }
      }

    • @engineers-blog
      @engineers-blog 5 років тому +1

      In postman i m getting 200 as status code

    • @Mukeshotwani
      @Mukeshotwani  5 років тому

      It should give 201, you can print log or debug

  • @abraham2961
    @abraham2961 6 років тому +1

    Any real api for testing purpose where we can do all operation

    • @Mukeshotwani
      @Mukeshotwani  6 років тому

      Hi Rehan twitter and facebook provide all api developer.twitter.com/en/docs.html

  • @sambhawjain2201
    @sambhawjain2201 4 роки тому

    please send restassured interview question basic to indetail

  • @professionalwork509
    @professionalwork509 5 років тому

    cant open regres.in no use

  • @towhidskynet
    @towhidskynet 6 років тому

    25:00

  • @pranalidhande1118
    @pranalidhande1118 4 роки тому

    Thanks for your video. Can you please make video on how to automate POST with 'xxx-urlencoded form' contentType. I have the scenario where the grant_type, scope, username and password needs to be send in 'xxx-urlencoded form' for authentication.
    As well I need to send client_id and Client Secret with all the above details. Please help me in this regard. Thanks. Looking forward for your reply.

  • @swatishilpa1136
    @swatishilpa1136 3 роки тому +1

    Hello Mukesh Sir, same here even i can't record the value of body as toJsonString - response.body(json.toJSONString());

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому

      Hey Swati, I guess it solved by one of the comment. Thank you.