3

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.

Jayashri Shinde
  • 327
  • 2
  • 9
  • I recommend to use an email provider that provides an API (eg GMail does https://developers.google.com/gmail/api). Then you could read the email containing the OTP with an additional request from Postman, save it as environment variable and use it in the next request. – Christian Baumann Aug 11 '20 at 06:53

1 Answers1

0

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.

Deepak Tiwari
  • 131
  • 1
  • 5