Search code examples
postmanpostman-collection-runner

How get response from setnextrequest:


Folder Request 1 Request 2

How can I get response from request 1, that I call in Request 2 -> prerequest script with this function postman.setNextRequest("Request 1")? I need info from response Request 1 use as varible in Request 2.

Thank you for you advice!


Solution

  • Not sure you can reuse the whole response.

    But you can access the response in the Tests of request 1 by pm.response, get the data you need and store them eg in an environment variable pm.environment.set("myVariable", "some value" and than access that variable after the request 1 has been executed pm.environment.get("myVariable")