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

Fetch the JSONobject value to a variable which is inside the dynamically generated JSONobject

We have below JSON response which has dynamically getting one of the JSONobject which has other objects inside. Tried some of the solutions provided here, but unable to get the values, every time getting 'null'. { "Result": { "12987654":…
la1
  • 519
  • 1
  • 8
  • 30
0
votes
1 answer

Cannot deserialize out of start_array token

This is my method for POST test public void createParagraph3() { RestAssured.baseURI = paragraphsURL; Map map = new HashMap(); map.put("featurePackage", Arrays.asList(new HashMap() {{ …
0
votes
2 answers

JSON Response Body of type array to Java Object

I am converting JSON response of type array into java Object class, but while doing deserialization i am getting error as com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1…
Arpit Aggarwal
  • 87
  • 6
  • 18
0
votes
1 answer

Count items and print in Extents Report's test.log ()

I cannot print a variable of type INT in the test.log () of the extents report and I need this information. @Test public void CT02_ContandoCategorias() { Response response = given().contentType("application/json").get(urlBase); …
Paulo Roberto
  • 1,498
  • 5
  • 19
  • 42
0
votes
1 answer

RestAssured -> Error handling on QueryParameters

// I am using RestAssured with Java. // I want to validate if my No 1 service fails and can't get the account number how can i use my hard //coded account number from no 2. Can someone help me on what error condition or strategy i can use? // …
Sam1977
  • 15
  • 4
0
votes
1 answer

Rest-Assured - How to validate response body with POJO

I'm freshman in Rest-Assured. I have a simple test which gets response body and I want to validate whether the response body matches with my POJO class. Here is my test: @Test public void getMySmartPlansList() { MySPList mysp = new…
Villa_7
  • 508
  • 4
  • 14
0
votes
1 answer

How to retrieve jsonObjects from a arraylist api response in Java

How to get jsonObjects from this below rest api response, using restAassured and java. My rest api is returning response as below. [ { "id": { "value": "1" }, "fieldName": "input", "jobId": "234" …
Venu
  • 3
  • 2
0
votes
0 answers

Automating the below REST API Post request(payload below) with builder pattern - unable to set only first element of list

//required Post request payload : { "paymentId":"787298", "reconciliationRecordInvoices" :[ { "invoiceNumber" : "1003", "supplierEmail" : "gs1003@mastercard.com", "purchaseOrderNumber" : "PO102", "accountNumber" …
0
votes
1 answer

Get size or length of json array response (restAssured Response interface)

We have REST API automation scripts using RestAssured. In this declared response object as public static Response response; and retrieving the response data using response.jsonPath().get("id"), during this trying to even get the size or length of…
la1
  • 519
  • 1
  • 8
  • 30
0
votes
0 answers

RestAssured Automation: Getting JsonGroovyExeption while run. Any possible solution for the same?

I am new to RestAssured. So tried a simple example. I have tried it in Eclipse. I am getting the jsonException saying Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized. What is…
0
votes
1 answer

Rest Assured: How do I pass the values given from one end point to another?

*New to Rest Assured Question: How do I pass values provided from endpoint 'A' to endpoint 'B'? My scenario: (using a UI api service that provides curls) [Endpoint 1] I provide a username in [GET] user/signin. I then get the follow response { …
0
votes
1 answer

How do I pass the email in alias header and obtain specific responses?

*New to Rest Assured Question: How do I pass the email (User email required for GET endpoint) in the alias header and obtain the session ID as well as the username ID from the response? Details: The [GET] users/signin endpoint requires a user…
0
votes
1 answer

Scenario Outline to use different data set by passing in REST API JSON body object

We have REST APIs with JSON BODY arrays/objects. To control the data to go in the JSON file at Runtime, using testdata.properties file where defining the data and calling that as below. We are using cucumber Serenity. Testdata.properties file: Value…
la1
  • 519
  • 1
  • 8
  • 30
0
votes
1 answer

Get all date using Rest Assured

I am using rest assured to test my API, I have an array list which contains date which I need to compare with JSON response, but I am not able to get all date values from the response ArrayList jsonElement =…
Cod
  • 179
  • 1
  • 12
0
votes
2 answers

Rest Assured: Getting org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body

I am trying to invoke a "put" api call with raw body in my code, but i am getting following error org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 69; received: 68 at…