Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Allows for adding of cookie parameters for the request. These should be entered in the <name>=<value> format with each pair on a separate line.  

Image Added

Response Variables

Allows for extracting values from JSON or XML responses and placing them into variables the configuration has access to. To extact values from the JSON and XML responses, JSONpath and XPath can be used. Each has their own syntax for extracting values for nodes within the objects they represent. Below is a list of some of the syntax allowed by each. 

XPathJSONPathDescription
/$The base node in the object.
.@The current object in the node path.
/. or []Accessing a child node, or specific child node
..n/aAccessing the parent of the current node.
//..Recursive child decent.
**Wildcard operator to access any node.
@n/aAccessing an attribute.
[][]Accessing an element within a list of nodes.
|[,]Union of two sets of nodes.
n/a[start:end:step]Accessing elements as a slice of a set of elements.
[]?()Accessing nodes with a filter applied.

Let's practice JSONPath expressions by some more examples. We start with a simple JSON structure built after an XML example representing a bookstore (original XML file).

Code Block
languagejs
themeMidnight
{ 
  "messages": {
    "staging": [ 
      { 
        "category": "information",
        "message" : "Building..."
      },
      { 
        "category": "information",
        "message" : "Testing..."
      },
      { 
        "category": "information",
        "message" : "Completed!"
      }
    ],
    "production": [
      { 
        "category": "information",
        "message" : "Building..."
      },
      { 
        "category": "error",
        "message" : "Build Failed!"
      }
    ]
  }
}

 

 

XPathJSONPathResult
/store/book/author$.store.book[*].authorthe authors of all books in the store
//author$..authorall authors
/store/*$.store.*all things in store, which are some books and a red bicycle.
/store//price$.store..pricethe price of everything in the store.
//book[3]$..book[2]the third book
//book[last()]$..book[(@.length-1)]
$..book[-1:]
the last book in order.
//book[position()<3]$..book[0,1]
$..book[:2]
the first two books
//book[isbn]$..book[?(@.isbn)]filter all books with isbn number
//book[price<10]$..book[?(@.price<10)]filter all books cheapier than 10
//*$..*all Elements in XML document. All members of JSON structure.

Successful Response Statues