Postman- Pass dynamic parameters to collection at run-time which is not part of response

Viewed 479

I have created postman collection for unit testing of APIs. I need to handle below scenario.

My second API generates OTP and sends it over email but its not part of response. I want to pass that OTP in request body of 3rd API.

I am executing postman collection using Collection Runner. Is there any way I can pause the execution and set this environment variable and then resume. Or any other better option. Please suggest.

1 Answers

There is a way to do it but it require some knowledge of server side technologies ( for example Spring boot). you can create a new api which is kind of wrapper over your OTP api and it will read the OTP from either your mail/DB and send it as a part of Http response and then you can use that wrapper API in your Postman collection to fetch the OTP and then save it as a env variable and use it in further apis. I am also doing the same way.

Related