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

Jsonpath: can not get the needed value using expressions

This is the example JSON { "customerId": 0, "authorizedCustomerIds": [ 0 ], "creativeVersionId": 0, "description": "string", "version": "string", "duration": 0, "frameRate": 0, "previewImage": "string", "previewVideo":…
Norayr Sargsyan
  • 1,737
  • 1
  • 12
  • 26
0
votes
3 answers

How to pass parameter in request body of restassured api in JAVA?

In below example, if i run this it is taking z as string, not as parameter, String z= "1234"; System.out.println("converted"+z); try { RestAssured.baseURI = "http://192.189.11.51:05/oceans/fssdata/"; …
sameer joshi
  • 377
  • 2
  • 8
  • 27
0
votes
2 answers

How can I change my restassured test using testng into cucumber?

I've been trying to transfer my restassured tests using testng over to cucumber and I've almost cracked it however the assertion has thrown me a little bit. This issue I have is the body in my assertion is throwing this error. java: cannot find…
0
votes
0 answers

Getting an error using restassured and testng. java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class org.hamcrest.Matcher

Hi I've been using these Json paths in the past but for some reason I've encountered an issue I can't seem to solve. I think it is something to do with my response having an array? Now when I tried yesterday I got a strange response which I'm no…
0
votes
1 answer

Unable to pass query parameter in RestAssured and hence returing NULL values

My request url is: http://........./api/vertex?q=id:1 //Rest assured code Response response = given().header("Authorization", "Bearer " + token). contentType(ContentType.JSON).queryParam("q", "id:1").when().get(url); It…
0
votes
1 answer

Exception "No such field: age for class: java.util.HashMap$Node" when search via "findAll" in response body

Good day. I try to validate a value of the "name" field in JSON response via "findAll" with the known value of the "age" field. Unfortunately, I get an exception "java.lang.IllegalArgumentException: No such field: age for class:…
0
votes
1 answer

Restassured: How Can we compare each element in Json array to one particular Same value in Java using Hemcrest Matchers, not using Foreach loop

Restassured: How Can we compare each element in Json array to one particular Same value in Java using Hemcrest Matchers, not using Foreach loop. { "id": 52352, "name": "Great Apartments", "floorplans": [ { "id": 5342622, …
0
votes
1 answer

How to fetch value of a key from an Array List which has JSON objects

ListownerLst= new ArrayList(); ownerLst= Util.extractListFromResponse(apiResponse, "", "", "owner"); public static List extractListFromResponse(Response apiResponse, String keyToMatch, String valueToMatch, String…
Dhruv Bhatnagar
  • 121
  • 5
  • 17
0
votes
0 answers

How to custom format REST Assured method chaining in Intellij IDEA

Trying to custom format my REST Assured method chaining using the latest version of IntelliJ IDEA. Am using IntelliJ IDEA Ultimate 2020.3 Build #IU-203.5981.144, built on November 30, 2020 and REST Assured 4.3.2. pom.xml:
PacificNW_Lover
  • 4,746
  • 31
  • 90
  • 144
0
votes
2 answers

How to put JSON array inside HTTP PUT call using REST Assured?

Am using rest assured to test an API which requires me to conduct an HTTP PUT with a JSON array, for the request body, which only looks like this: ["6", "7", "8", "9", "10"] Please note that this doesn't require the opening and closing { } - just…
PacificNW_Lover
  • 4,746
  • 31
  • 90
  • 144
0
votes
0 answers

get key value from GraphQL query

I have a requirement to get the value from the Graphql query and validate it with a string, I tried converting it to json and used jsonpath to get the value but it is failling Here is the request query { ethereum { dexTrades(date:…
0
votes
1 answer

How to set post request payload from json file restassured

Need help on below scenario: I have below pojo class and when i make post call using restassured i dont want to set each field in my java class.To acheive these want to maintain one createissue.json file. when making post call, i want to read each…
0
votes
1 answer

Is it possible to validate max length check in API Testing Using Selenium

I'm developing a automation script using selenium-cucumber-java with testNG combination for API testing. In UI there is a some validation available as text box should accept 500 characters only, if more that text box will not allow to enter. Same…
0
votes
1 answer

JsonPath (Rest Assured): Get a JsonPath out of JsonPath

Is it possible to get a new JsonPath object out of a current one? The only thing I've found is setRootPath() but that's not exactly what I'm looking for since you cannot "go back" once you've set the root. My use case: I have a JSON array of…
IsaacLevon
  • 2,260
  • 4
  • 41
  • 83
0
votes
0 answers

RestAssured Not able to extract response

I am trying to get the id_token.basic value but its not working because of .basic { "user_id": "12345", "id_tokens": [ { "id_token.basic": "myid123" } ] } Tried the below, but because of .basic its not…
Sam1977
  • 15
  • 4