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

Get value from json based on condition using JsonPath

I've following json - { "issues": [{ "id": 200615, "custom_fields": [{ "id": 166, "name": "Severity", "internal_name": null, "field_format": "list", "value": "Major" }, { "id": 167, …
Alpha
  • 13,320
  • 27
  • 96
  • 163
1
vote
2 answers

No signature of method: static io.restassured.internal.http.URIBuilder.encode()

I am trying to check basic rest assured get method and getting below error. Using the below version: rest-assured-4.2.0-dist.zip.I am trying to check basic rest assured get method and getting below error. Using the below version:…
1
vote
3 answers

How to convert RestAssured Response to Java List

[ { "tags": [], "id": "aaaaaaaaaaaa", "author": "admin", "type": "profile", "description": "", "name": "defaultProfile1", "display_name": "Default1" }, { "tags": [], "id": "bbbbbbbbbbbbb", "author": "admin", …
ssharma
  • 935
  • 2
  • 19
  • 43
1
vote
5 answers

how to retrieve values of the map returned by jsonPath().getMap methods of rest assured

how to retrieve values of the map returned by jsonPath().getMap methods of rest assured I am trying to get the response on below api in Map, which I am able to successfully get but when I try to access the value of key "id" in the below code, I get…
1
vote
3 answers

Unable to get value of key with spaces using JsonPath library

I'm using Json Path library to parse JSON. I've following json which has key with space: { "attributes": { "First Name": "Jim", "Last Name": "Rohn" } } In order to get value of First Name, I wrote code like (where json is…
Alpha
  • 13,320
  • 27
  • 96
  • 163
1
vote
1 answer

Getting java.net.ConnectException whenever I run my test case

package restAssuredTesting; import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.equalTo; import org.testng.annotations.Test; public class DemoProjectForGet { @Test public void getWhetherDetails() { …
1
vote
1 answer

Get String value from JsonPath matching multiple conditions

jsonArray = "[{ "id": "12", "Area": "Room", "Type": "Small", "mode": "Work", }, { "id": "243", "Area": "Hall", "Type": "Large", "mode": "Living", }, { "id": "561", …
sankardev51
  • 37
  • 1
  • 6
1
vote
1 answer

How to get the value from a List using Rest Assured?

I am trying to grab the first value of courseNumber for studenId=123 using Rest Assured. When I using .body("students.courseList.courseNumber[0]",equalTo(1000000000)) I am getting: Expected: <1000000000> Actual: [1000000000, 1000000001, 1000000002,…
Shiv
  • 13
  • 2
1
vote
0 answers

REST ASSURED: how to parse json response which contains "."

New to rest assured. I have a rest API JSON response like below, and I'd like to extract value of "value", how can I do it? { "google.com": { "company": google, "state": "CA", "value": 123456789 } } I have tried with…
Q.W.
  • 122
  • 1
  • 10
1
vote
1 answer

Rest Assured Json Path returns Exception

I´m reading json from a file in order to compare it to an http request body´s json. I´m doing JsonPath expectedJson = new JsonPath(new File("response.json")); // some more code assertThat().body("", equalTo(expectedJson.getMap(""))); which results…
Christian Baumann
  • 3,188
  • 3
  • 20
  • 37
1
vote
3 answers

Timeout error in RestAssured whereas the service giving response in postman/soapUI

This code is giving timeout error whereas the service giving response in postman/soapUI I am trying to automate the rest service. The service working fine soapUI whereas when automating in restAssured giving timeout error. import…
1
vote
2 answers

pass json file to testNG Data Provider

How can I pass Json File which contains a json array to TestNG data Provider and use it in my test to parametrize my test cases. this is a Json file which I want to pass to TestNG test cases as Data Provider : {"TestList":[{ …
ssharma
  • 935
  • 2
  • 19
  • 43
1
vote
1 answer

Valid JSONPath is throwing EOF in RestAssured JsonPath

The JSONPath that is normally working is not working when used in rest-assured-JSONPath tenants=jpath.getList("$..aa[?(@.name=='tid')].value"); is throwing Script1.groovy: 1: expecting EOF, found '[' @ line 1, column 59. …
Red Ant
  • 315
  • 4
  • 17
1
vote
2 answers

How to replace a JSON value stored in a JSON file and use that in a Rest Assured test

I have a set of input data files in JSON and I am trying to replace a value present in a JSON file and use that value to do a post request in restAssured The JSON file has { "items": [ { "item_ref": 241, "price":…
Mihir
  • 491
  • 5
  • 21
1
vote
1 answer

Bad Request 400 and deserialization error while testing api using rest assured put method

I am testing endpoint with path para and query para and updating the request with some parameters. When I send the request content type is json and request looks good with the data that i am trying to change however when response is received…