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

How to get the values from JSON where JSON starts with Array Block in RestAssured

I am automating twitter API using RestAssured I am trying to fetch the response from twitter API: String responseTweets = given().header("Authorization", "Bearer" +" "+token) .queryParam("count", "5") …
Jyoti
  • 35
  • 9
0
votes
1 answer

Rest Assured response - validating nodes matching the same path

In my tests a have a responses like this: { "commands": [ { "type": "com.our.identity.patch", "value": [ { "op": "add", "path": "/claims/gTwfQubKEl4r", …
Prophet
  • 32,350
  • 22
  • 54
  • 79
0
votes
0 answers

I have a error while running my TestNG in Eclipse IDE , Can anyone have a look

This is the Code: package myrestassuredpractise; import java.util.concurrent.TimeUnit; import org.junit.Assert; import org.testng.annotations.Test; import io.restassured.RestAssured; import io.restassured.response.Response; public class…
0
votes
1 answer

how to mock server endpoint in RestAssured

i am doing API testing of a bank application (kind of mobile banking) where client gets connection through phone as a sms code.There is an endpoint where u enter received code to get access to other functionalities of the app. And it is not good…
0
votes
1 answer

In Rest Assured while trying to get token facing issue "Failed to parse the JSON document"

public void appTocken() { RestAssured.baseURI ="https://localhost"; RequestSpecification request = RestAssured.given(); String payload= "{ \"client_id\": \"ahsan@gmail.com\",\r\n" + " \"client_secret\": \"1212\",\r\n" + " …
0
votes
1 answer

How to create query param body with multiple key param values

In the below hashmap you can see, I have list of key param values for which I need to automate cases for multiple values without repeating the hashmap rather it would be and update. How I am doing it: 1st test case HashMap queryParam…
Sobhit Sharma
  • 697
  • 14
  • 45
0
votes
1 answer

How do we create pojo class and set values for array of JSON

How do we create pojo class and set values for array of JSON Sample { "expiresAt": "2022-04-28T09:28:00.890Z", "qualifiers": [ { "dataType": "INTEGER", "key": "/account.ACCOUNT_NO", "operator": "GT", "value": "value123" }, { …
0
votes
0 answers

Not able to get JSON Data from API URL using Rest Assured and JAVA

I have the following URL: http://example.com/stocks/rank_by_category/json/C:A:5/5 I have tried using the below code but it is returning blank data. I have tried fetching the data through Postman and it is returning data correctly. @Test String…
0
votes
1 answer

Using REST Assured, how can I validate the data type in an array of Json object

I'm new to Rest Assured and trying to do some validations using json-schema-validator version-4.3.0. Getting errors while running it. Need help in this. This is my schema(sample.json): { "$schema": "http://json-schema.org/draft-04/schema#", …
Gaurav Marothia
  • 163
  • 2
  • 2
  • 14
0
votes
1 answer

Get the array objects name with rest assured

Example JSON [ { "PROPERTY1": [ { "name": "String" "value: 0 }, { "surname": "String", "age": 20 } ] }, { …
Norayr Sargsyan
  • 1,737
  • 1
  • 12
  • 26
0
votes
1 answer

How to have location header returned from RestAssured response

I'm using RestAssured and I need to get the value set under the location header that is returned by my api so that I can use it as a bearer token on my next request. I tried some things like cookieHeader but I dont think that's it. Response…
Francislainy Campos
  • 3,462
  • 4
  • 33
  • 81
0
votes
1 answer

Rest Assured how ignore a parameter in the api respond and compare it with a json

Hello i am using rest assured to compare a expected json but the problem that i have right now it the ID parameter is different every time i am executing the call from rest assured and i want to find the adequate way to validate the response…
0
votes
2 answers

I am getting "java.util.zip.ZipException: unknown compression method" in my restassured code

I am getting this error "java.util.zip.ZipException: unknown compression method" however I am dealing with the API rest-assured. Could it be related to dependencies in the pom.xml? I googled this issue and just have seen that it is about zip files…
laura
  • 357
  • 3
  • 16
0
votes
1 answer

RestAssured - want to verify the body structure of JSON response in RestAssured

When i request for GET request, I'm getting the JSON response, but here my requirement is to validate the structure of response body. For example: { "lotto":{ "lottoId":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[ …
0
votes
1 answer

Serializing using Rest Assured response.jsonPath().getObject() returns null

I have an API returning JSON which looks like this {"listings":[ { "albumId": 1, "id": 1, "title": "accusamus beatae ad facilis cum similique qui sunt", "url": "https://via.placeholder.com/600/92c952", "thumbnailUrl":…
keylogger
  • 822
  • 3
  • 19
  • 39