How to use Response Parsed Body Dynamic Value

So I'll continue to write some tips about Paw, to temporarily compensate the lack of documentation…

Dynamic Values are quite helpful to make your requests flexible, avoid constant copy/paste, make your computations right in the app, etc. It's adding some magic to HTTP testing.

The Response Parsed Body Dynamic Value parses JSON, XML and URL Encoded (Content-Type application/x-www-form-urlencoded) responses so you can send back some field in another request.

Copy right from the response (JSON and URL Encoded)

When you have a JSON or URL Encoded response, you can copy all set up the Dynamic Value right from Response View. Just right-click on an element, and the option Copy as Dynamic Value will show up.

Once done, the Dynamic Value is in your clipboard, ready to be pasted anywhere.

As you can notice here, the Dynamic Value takes the value from the JSON of the previous request.

Create in a field

As Response parsing is not (yet) supported for XML, you can't copy from the response in that case.

In any field, right-click and pick Response > Response Parsed Body.

Then choose the request you want to parse, and optionally the format (in Automatic mode, the format will depend on the response Content-Type header). The Key Path is the path to the element you want to access. The path is composed of keys separated by dots ., or indexes [i] for arrays and lists.

  • For JSON, you may have something like items[0].name
  • For XML, the access item.attribute for attributes, and item.text for its value. It's somehow similar to XPath
  • For URL Encoded, just specify the key you want to access

Comments

comments powered by Disqus