Creating a Postman Collection From Swagger
By Robert (@gadapunkfun) M
Background
This is probably not news to anyone that has been working as developer consultant. Large existing code base; in our case it’s an application that has existed for about 2,5 years and during that time it has developed several services and therefore has many endpoints.
Therefore when me and my colleagues had to start developing new features it was hard to know what was available and what wasn’t with over 50 different endpoints to hit.
Solution
We know and love Postman © so we wanted to find a way to use that to share an equal standing ground consisting of shared knowledge.
After frantically pressing buttons and looking around the Postman © application we found the convenient button labeled Import
and that’s when me and my colleague said aha! 💡After opening that menu option we saw that importing data from Swagger was possible and the project we were working with had that one requirement.
Action
So here’s a quick and easy guide on how to create a new collection in Postman © through Swagger; quick and easy no doubt thanks to the amazing team of developers over at Postman ©!
- Open Postman
- Click Import
- Paste link or drag n drop the swagger json file
- Voilá!
Final Notes
This is a fantastic feature to keep in mind not only for scenarios similar to this it’s also good if you want to use other tools that Postman © offers. As an example you can create simple JavaScript scripts to set authentication token for your requests, something you clearly can’t do in Swagger, making local development environment that much easier and looking more professional. (thanks @BunnyFiscuit for showing me that trick).