Using Paw, I am accessing an endpoint that I use to make an authentication request. The response is returned via JSON and contains a sessionId, which I need to place 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 to script the extraction of the sessionId value from the authentication response and place the value into the environment variable, without having to perform a copy and paste each time I authenticate?
Thank you for the assistance.
Sorry for the late answer. The right way of achieving this in Paw is in a declarative manner. Instead of extracting from the response on each call, you set the environment variable's value to point to a specific field within this JSON response.
For that, the Response Parsed Body Dynamic Value will be helpful.
You can read the documentation about this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With