Questions tagged [gpath]

Path expression language integrated into Groovy which allows parts of nested structured data to be identified. Can be used to query XML and nested Plain Old Java Objects

An overview of GPath with some sample code can be found on the codehause.org site

http://groovy.codehaus.org/GPath

79 questions
0
votes
1 answer

What will be the GPath expression for Rest Assured

I have tried to create GPath expression with filter criteria to return "my-notes" in list of object when '"my-type"' is SPECIAL like : '"data.my-node.nodes.findAll{it.'my-type'=='GENERAL'}.'my-nodes'"' but unable to get response from the below…
saba
  • 539
  • 1
  • 14
  • 30
0
votes
2 answers

JSONPath union "[,]" equivalent in GPath

Consider given JSON { "data": { "array": [ { "foo": {"a": "1 foo a", "b": "2 foo b", "c": 512}, "bar": {"a": "3 bar a", "b": "4 bar b"}, "baz": {"a": "5 baz a", "b": "6 baz b", "d": 75}, "other": {"a": 2,…
RomanMitasov
  • 925
  • 9
  • 25
0
votes
1 answer

I need to send the request correctly, but I don't know how to get the required values from objects

How to get a new list from the list of objects? I need a new list of objects to POST request this list of objects i get from response: { "success": true, "body": { "users": [ { "type": "unknown", "data": [ …
vVv
  • 3
  • 2
0
votes
1 answer

RestAssured Groovy gpath findAll returns a single value in case it finds only one match

Given an xml like 1 2 I would like to get all the values from a String tagName = "bar" List bars = xmlPath.get(String.format("**.findAll {it.name() == '%s' }", tagName)); It is working when i have…
0
votes
1 answer

How to get the summation of values using gpath sum() in restassured on JSON Object

I was trying to find the summation of deceased count from JSON object extract from the following JSON response https://api.covid19india.org/state_district_wise.json Snippet from above is json "Maharashtra": { "districtData": { …
nikhil udgirkar
  • 367
  • 1
  • 7
  • 23
0
votes
1 answer

Rest Assured Groovy GPath filtering out result

I am trying to return the value of "description" in "dependentPreferences" where the response meets two conditions: First, check if the name is "John Smith" and then check if the "image" in preferences equals to "papaya.jpg". The response body is as…
kokodee
  • 285
  • 1
  • 3
  • 15
0
votes
1 answer

Expressions of JSONPath for rest assured in a list with maven dependesies

I am trying to fetch data which is in JSON format. I am using maven dependency, testng and rest-assured. I want to test Rest API.BUT getting an error of java.lang.NullPointerException Here is my code - public class CountBook { @Test public…
Ferdousi
  • 319
  • 5
  • 17
0
votes
1 answer

GPATH query - Return the parent node comparing the child nodes

I am new to this groovy. I am looking for all the videoGame nodes whose tag id attribute matches to "4". def text = ''' 3 testName 3
Raj
  • 101
  • 7
0
votes
1 answer

How can i get a max value for userId from this rest endpoint? I have to use RestAssured with Gpath syntax

I have to get a max value for userId using RestAssured and Gpath syntax. I dont know what i should type in body after then. I have tried so many ways but it does not work. @BeforeClass public void setUp() { endpoint =…
idzik
  • 1
0
votes
1 answer

RestAssured Json response verification with GPath

I receive the following response on a bad request against my API. I am using RestAssured for my rest response assertions. { "message": "An entity of type topic was passed in an invalid format", "meta": { "display": { …
Ihor M.
  • 2,728
  • 3
  • 44
  • 70
0
votes
1 answer

Find XML node with a specific child using GPath

I am looking for a GPath expression to find a node with a specific child. …
Marek Stejskal
  • 2,698
  • 1
  • 20
  • 30
0
votes
1 answer

How to search in anonymous and nested array using find or findAll in groovy's closures using REST-Assured library?

I have following JSON response anonymous body and I need to parse nested arrays dynamically to retrieve a key's value based on a condition by using find or findAll in the groovy's closures [ { "children": [ { "attr": { …
Raj
  • 31
  • 1
  • 7
0
votes
1 answer

json-Path (Restassured) how to bypass the root element or use wild cards to get the node values-

I am having the following response body via rest assured in java { "-1": { "totalExecutions": 0, "endDate": "", "description": "", "totalExecuted": 0, "started": "", "versionName": "Unscheduled", "expand":…
Jinx
  • 43
  • 7
0
votes
1 answer

Move a node with Gpath

Given the data model ... I want to move the child nodes of into…
Nerethar
  • 327
  • 2
  • 16
0
votes
1 answer

GPath testing for decimal value

Using Rest Assured in Java to test some APIs. Trying to use GPath to return a value. Why does this work? int i = response.path("Result.find{it.Amount>293.50 && it.Amount<293.52 && it.CreatedDate=='10/26/2018'}.Id"); But this doesn't? int i =…
Anton
  • 761
  • 17
  • 40
1 10
2 95