Importing NestJS Swagger to Postman

In this very small post we will see how to migrate your NestJS APIs to Postman with the help of NestJS Swagger package.

According to NestJS docs - @nestjs/swagger allows you to download the swagger JSON config by adding -json to the URL. For example, if your swagger is available at http://localhost:3000/api, you can download the JSON config from http://localhost:3000/api-json:

Swagger JSON file

After saving that JSON file on your drive - you can import it to a Postman collection by clicking on main menu File -> Import, selecting saved JSON file and clicking Import button:

Postman import window

After import is finished - you will see a new collection in your Postman:

Postman import result