Paw: copy response field on Wednesday

Using Paw, I get access to the endpoint that I use to create an authentication request. The response is returned via JSON and contains sessionId, which I need to put into my environment as a variable (SESSION_ID). This environment variable is then used in the authorization header of all requests sent back to the server.

Is there a way for a script to extract the sessionId value from an authentication response and put the value in an environment variable without having to execute a copy and paste every time I authenticate?

Thanks for the help.

+6
source share
1 answer

Sorry for the late reply. The right way to achieve this in a paw is declarative. Instead of extracting from the response to each call, you set the environment variable to indicate a specific field in this JSON response.

The dynamic value of the dynamic effect on the answers is useful for this.

  • In a JSON or Form URL-Encoded response, right-click on the field and select "Copy as dynamic value of the response body":

Copy the dynamic value of the response body from the response field to the paws

  1. Paste it in your environment or in any field you want:

Use response field anywhere in Paw

You can read the documentation about this .

+2
source