Use variable from response from POST in header GET request

Hello,
In my testcase i have a Post request, which returns a response with a header and body. In the response body there is a consentId - number which i have to use in the header of for my next GET request. I

What do i have to do?

Hey @richardkr,

You can capture the value as a variable using a short script in the Tests tab:

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

This is assuming a very basic structured response so that reference to the value might be slightly different. I’ve used a global variable here but the same could be down using the other scopes.

Once you have that consentId value as the variable, you will be able to use it in your next request’s header using the {{consentId}} syntax.