How to save a response as a variable and reuse it for another API call

You can achieve this using Postman’s JavaScript APIs in your request scripts.

The pm object provides most of the functionality for testing your request and response data, the response data is accessible in the Tests tab of the request, as the scripts will be executed once a response has been received.

You can use the pm.response object to access the data returned in the response for the current request.

See a real-life example exploring this collection.



Have more questions? Submit a request