Questions tagged [rest-assured-jsonpath]

For use only with the popular REST-Assured API testing framework for Java.

Path-based query syntax for JSON documents in the REST-Assured framework for API testing. Not to be confused with the JsonPath specification (http://goessner.net/articles/JsonPath/)

Docs: https://github.com/rest-assured/rest-assured/wiki/Usage#json-using-jsonpath

382 questions
0
votes
1 answer

Multipart in rest assured doesnot pass the files name properly

This is my code to rest my api to upload file given().auth().preemptive().basic("*****","****").contentType("multipart/form-data").multiPart("type", "SAMPLE_XML"). multiPart("preview_file",new File("C://hello.xml")). multiPart("connector_id",…
0
votes
1 answer

Hamcrest matchers

I have written a hamcrest like this in RestAssured response specification builder.expectBody("hotelavailabilities.rateplans.rooms.adults", anyOf( hasItemInArray( anyOf( hasItemInArray( …
0
votes
1 answer

Parse through Json response using rest-assured

I want to parse through my JSON response to validate the response i obtained. [ { "Emp": "00000", "Emp_ID": 901, "First_Name": "agar", "Last_Name": "vedi", "Country": "India", "EmpLocation":…
0
votes
3 answers

Get rid of sqare bracers. Or how to get actual string

I'm getting trough initial very first blind steps of rest-assured with Java. I have few requests, which actually works well and I started to add assertions. So I'm sending request, getting JSON as response, extracting it. And I need to verify if…
0
votes
2 answers

How can I get the API response in TestNG using Rest Assured to print out line by line?

I created a program to get an API response from a URL. But for some reason it's printing it out in one long line. Is there any way to print it out the way I see it in postman? I guess what I mean is if there is a way to see the response from the API…
Bekind
  • 55
  • 1
  • 13
0
votes
2 answers

Hamcrest exception message while actual and expected are same

I am getting the below exception message while having actual and expected are same. The given reason for the failure seems to be incorrect. @Test public static void Verify() { given(). …
Learner
  • 481
  • 1
  • 15
  • 28
0
votes
1 answer

Get data from outside the root level of response

I'm still kind of new to REST and haven't been able to figure this one out. I have a response like this one: { "StatusCode": 200, "Result": { "CustomerStuff": { "Name": "John", "State": "Oregon", …
Anton
  • 761
  • 17
  • 40
0
votes
2 answers

How to check particular json array parameter values from jsonarray

I am suing restassured for automating my apis, here is my jsonResponse:- { "al": [{ "aid": 1464, "_r": "Bus Stand,", "_l": "spaze it park2,", "_c": ",", "_s": "Haryana,", …
0
votes
2 answers

extract value from json array of API response without brackets not working

Here is JSON: { "first":0, "rows":100, "data":[ { "id":326, "tag":"QATA9", "workNo":"qat12345" } ], "totalRecords":1 } And my code is : JsonPath jsonPathEvaluator = response.jsonPath(); wID =…
0
votes
0 answers

How To Fetch NetworkID from following Json response using Rest Assured

{ "Image": "sha256:357a02cbb63175a797ea238665bd1cfe6210f0381670d7155b034a58020a65f5", "NetworkSettings": { "IPAddress": "172.17.0.6", "IPPrefixLen": 16, "Gateway": "172.17.0.1", "Bridge": "", …
Arun
  • 63
  • 1
  • 2
  • 11
0
votes
0 answers

How to check size of a Json array using a DTO object?

I need to get the size of the "description" array, convert to object dto. I need to check with rest assured if my array "description" contains at least 1 element inside. How do I do that? My Json { "success": true, "description": [ { …
JJB
  • 115
  • 1
  • 1
  • 7
0
votes
1 answer

JSON path title doesn't match

I write a simple test using rest-assured, code below @Test public void exampleRestTest() { RestAssured.baseURI = "https://jsonplaceholder.typicode.com/"; Response res = RestAssured.get("posts/1"); res.print(); res.then() …
0
votes
1 answer

Getting HTTP 401 error while trying to validate the connection.I am using rest assured to automate

/*I have passed session cookies manually in below code.when i pass the session cookies in post man its working fine but in eclipse it giving 401 HTTP error.I am very new to rest assured.please let me know if anything is wrong with the code.I have…
0
votes
2 answers

How to convert JSON response to Java List- Using Rest Assured for API Testing

I have a nested JSON response. JsonResponse Screenshot I want to get the the dictionary at 0th location from the list and then get a particular element from it. For e.g. In response, {0} and {1}, I want to get complete {0} as a result. Then from…
D Bhatnagar
  • 133
  • 1
  • 1
  • 9
0
votes
2 answers

How to get the access token of REST API endpoint using Rest Assured with POST method, Currently I am getting 404 error?

I am trying to run POST method to get the access token using REST Assured Code. But it is returning 404 error. My code is as below. POSTMAN Configuration as below same trying to replicate using Rest Assured Method : POST Authorization tab: …