Collect value from one response and automatically paste the result in another request

Hi,

I am quite new to Postman and i am looking into creating themplates for a chain of requests i have made.
How can i automatically collect the value from the response “ShpCSID” in request1:
image

And automatically populate the value in the data key in request2
image

Hey @joakim.nilsson

Welcome to the Postman Community! :wave:

If you add this to the Tests of the first request it will store the ShpCSID value as a global variable. I’ve used a global variable here for ease but you could set this at the environment and collection level if you needed too.

pm.globals.set("ShpCSID", pm.response.json().ShpCSID)

In the second request, use { "ShpCSID": {{ShpCSID}} } in place of the hardcoded value.

More information about variables and how to use them can be found here:

https://learning.postman.com/docs/sending-requests/variables/

Thank you so much for this!

1 Like