Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger a request before sending another request using POSTMAN

Tags:

rest

postman

I have two requests (Lets call them R1 and R2). I am able to trigger them individually from POSTMAN. But my requirement is, when R2 is triggered, automatically R1 should be triggered first and then R2 should be fired.

Please help me achieve this.

P.S: I Googled about this problem and no where it is mentioned about how to trigger another request from pre-request script. All they are saying is you can run some code in pre-request script.

like image 992
Maruthi Srinivas Avatar asked Oct 20 '25 14:10

Maruthi Srinivas


1 Answers

in test script of R1 use

pm.environment.set("R1",pm.request)

And in pre-request of R2

pm.sendRequest(pm.environment.get("R1"))

Now when ever you send R2 , R1 will be send

like image 182
PDHide Avatar answered Oct 22 '25 04:10

PDHide



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!