Hey, i need to catch some values which are generated as temporary header values. i need to catch the oauth code which is generated as temporary header value to get the access token.is there anyway to save thad oauth code to variable.
Welcome to the Postman Community
You could use the
pm.request.headers.get() function to capture the value of the header.
For example, adding this to the
Tests tab would set the
Authorization header, as the
token environment variable.
Is this what you were looking to do?
@dannydainton Thank you for the solution and the fast replying.it’s very appreciated. it really helped me.but i need to know how to catch these values which i have numbered on the image that i have attached.
- code (inside the Request Body).
- access_token (inside Response Body).
This question seems to have now morphed into wanting to get the values from the
Headers to you wanting to get the values from a
Request and a
We also have an in-app Bootcamp which is packed full of interactive lessons, it will guide you through some of the application’s awesome features.
For your particular problem, you could use something like this, in the
Tests sandbox, to log the values to the Postman Console:
Once you’re happy with the values, you will be able to set them as variables using the syntax as previously mentioned.