Hi there,
I have request A and B. Both are x-www-form-urlencoded type requests. In response to request A, I will get referenceID which is a GUID. I use this referenceID in my request B. I wonder if I can send let’s say 100 requests for A and B in postman of course without sending request A and copying referenceID to the request B one by one 100 times
?
Hey @kizildagcenk
This sounds like you’re wanting to chain requests together, taking the response from A and using that in B.
This can be achieved by adding a script in the first request’s Tests
tab, to capture the value from the response as a variable. This variable can then be referenced in the second request using the {{...}}
syntax.
A rough example of this could be:
The response body from the first request:
{
"refId": "ABC123"
}
Script added to the Tests
tab to capture the variable:
pm.globals.set('var_name', pm.response.json().refId)
Referencing the variable in the second request:
https://www.example.com?id={{var_name}}
There are various guides in our learning centre and also different video tutorials on our Youtube channel that show this process in practice, using examples.
thank you @danny-dainton, I will check and let you know.
1 Like