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
0 answers

How to assert condition to check if an object is available in json response of an API

I have a JSON key value pair which would come for a particular condition satisfies if that condition fails i will not see that key and value how can assert that using rest API automation code here is the sample snippet. I have a json key value pair…
0
votes
0 answers

Getting 400 error with Restassured POST whereas POSTman based request giving 200

Code snippet @Test(priority = 1) public void apiFacadePOSTLaunchSurvey() { endpoints.chooseEndPoint("accounts"); response = endpoints.postLaunchSurvey(test_survey_Id_in_draft_state,account_id, jwtToken); System.out.println("\n DEBUG::…
user2451016
  • 1,857
  • 3
  • 20
  • 44
0
votes
1 answer

Not able to filter out a value in jsonPath

I am working on JSONPath where I need to fetch a value for a particular country below is the given JSON. { "homeCountry": "USA", "internationalControlDetails": [ { "address": { "city": null, …
0
votes
0 answers

how can i compare DTO classes with JsonResponse and check if any Node which is present in DTO is missing in Response class?

I had a Complex Pojo class in Java which contains multiple classes as attributes. Let's call it my DTO. Now I am using an Object Mapper which Maps a JSON mapper to that class. Now my problem is that I need a method to check if My Response contains…
Karan
  • 443
  • 5
  • 14
0
votes
2 answers

Send complete request JSON body in List form

I am a beginner in Restassured. I have a PATCH request body which I need to sent in List form as: [{"meal":1434751,"names":["Marisa Kwan","Marisa Kwan"],"quantity":2,"menu_item":163606,"user":45112}] But I am not sure how to send it in required…
Saurabh
  • 81
  • 10
0
votes
1 answer

How to filter value from api response using rest Assured

I have a response json as below. where I have multiple nested json in an array having details of spends on particular channel. I need to get the spend value of "EMAIL" only. How can I check for the condition where it is EMAIL get the value for that…
Adil Raza
  • 65
  • 6
0
votes
0 answers

Comparing 2 complex nested array of Json objects while ignoring one field that is "documentURL" in Java and getting error " class has no field" error

error image that show value is not getting populated from jsonBelow given is json file used for comparison assume It is having 2 copies which are getting compared { "FileInformation": [ { "ProductCode": "", "MaterialName": "", …
0
votes
0 answers

How can we convert a String variable into JsonString in restAssured

question-> here I want to convert the qciResponse variable into Json and fetch userId from qciResponse, how can we do that..? public String setRemoveLoginIdRequestBody (String awsEndPoint, String loginId) throws Exception { JSONObject joi = new…
0
votes
1 answer

Unable to pass raw JSON request body with response error "The browser (or proxy) sent a request that this server could not understand"

I am trying to make a GET request to the URI which has header Content-Type=application/json and has a request body which is a raw JSON type. Below is the code I am using with RestAssured API but it throws an error in response saying "The browser (or…
0
votes
1 answer

Error in extracting json response properties of hydra:collection using RestAssured Java

I'm extracting MailTM GET /domains API properties and need to extract the hydra:member from the following API response. { "@context": "/contexts/Domain", "@id": "/domains", "@type": "hydra:Collection", "hydra:member": [ { "@id":…
0
votes
1 answer

How to handle If else condition in rest assured

Description: I have made two different class methods, setpassword and resetpassword. If my resultStatus and resultMsg is "F" and "PASSWORD_NOT_EXIST" in resetpassword class method, then i have to call set password method which is another class…
0
votes
0 answers

How to validate dynamic response structure & data for a GraphQL service using Rest Assured

I am new to Rest Assured & GraphQL service. I have a test requirement where I need to validate the address data in JSON response received for multiple PIN codes & fieldnames sent in the…
0
votes
0 answers

How to remove common elements from two array using Jway Json Path

Below is the input JSON array and I'm expecting non identical object which is not present in the second array in the output. JSON Path version I'm using: 2.7.0 { "first": [ { "id": "1" }, { "id":…
0
votes
1 answer

How do I match items in a list from an anonymous root from a RestAssured body?

I have this output [ {"name": "a"}, {"name": "b"} ] And the following code given() .get("endpoint") .then() .body("$.name", hasItem("b")); But I get this result java.lang.AssertionError: 1 expectation failed. JSON path $.name doesn't…
mdong
  • 345
  • 3
  • 10
0
votes
0 answers

How to get json key values by another key value

I have a JSON output like this: { "items": [ { "id": "1", "name": "Anna", "values": [ { "code": "Latin", "grade": 1 }, …
jacob1989
  • 15
  • 3