All about Postman Collection

Probably many of you are already familiar with the popular API testing tool Postman.

This is a powerful and widely used tool and definitely one of the most important tools in any web developer's arsenal.

Today, we will learn how to use Postman collections. We will learn about the following things:

  • What is a postman collection?

  • How do you create postman collections?

  • How do you import and export the Postman collection?

What is Postman?

Postman is the API testing tool for testing REST Apis and GraphQL Apis, creating collections, importing/exporting collections, and much more.

Postman API Platform | Sign Up for Free Over 20 million developers use Postman. Get started by signing up or downloading the desktop app. What is Postman…www.postman.com

What is a Postman collection?

The Postman collection is the feature for combining the API in the same group, so you don’t need to find it every time; you can add all the APIs in one collection and save it.

So, whenever you need to test those APIs next time, you can open that collection, and all the details will be there for that API, like header, body, params, cookies, etc.

How do you create Postman collections?

Let’s see step-by-step how we can create a new Postman collection.

Step 1:

You need to click on the “New” Button, as shown in the screenshot below.

create new collection button

Step 2:

On the popup screen, click “Collection,” as shown below.

Create collection

Step 3:

After that, give the name of the collection. You can also add an authorization method that will be used for every API call you make in this collection.

Authorization method for a collection

You can also add a Pre-request Script, which will execute before every request in this collection.

There is another option for Tests that will execute after every request in this collection. Variables are a handy feature where you can define global variables and use them in APIs belonging to this collection.

There are lots of features like documentation and comments, etc.

Step 4:

The popup menu will open after you click on the three dots on the collection name.

You can create a new folder / new request. You can add requests inside the folder as well.

Apart from that, there are other options, like renaming collection, duplicating collection, deleting, running collection, exporting collection, and many more.

Add a request

Step 5:

After you click on the Add request, you will see the below screen where you can add the request URL.

Then select Request Types (GET, POST, PUT, PATCH, DELETE, etc.); you can add authorization like bearer token and modify headers and body.

You can also add Pre-request scripts and Tests, as I showed earlier when we created the collection. After that, click send, and you will get the API response.

Add a request

You can follow all the repeat steps 4 and 5 to add more requests/folders. You can also add documentation and comments, the same as a collection for each request.

Import and export postman collection

This is an essential part of any API because you can share the collection with other users, so others don’t have to create it; they can import it and use it directly.

Click on the three dots at the right side of the collection, and in the popup menu, you can select the export option.

After that, click on the Export button to see the popup for saving the file. Give the name of the file and click on save.

Export API

You can export the Postman collection and share that file with others. Now you can also import other collections as well.

Click on the import button, and you will see the below screen where you need to click on upload file and select that file; you can also import the collection from the link.

Import API collection

You can also import this collection to the mobile app and test it. This is possible by using the API Tester.

You can download the app as per your platform, Android or iOS. Using the API Tester, you can test any API directly from a mobile phone on the go from anywhere in the world.

AndroidGoogle Play Store (API Tester)

iOS— Apple App Store (API Tester)

After installing the application, you need to click on the “plus” icon at the top right-hand side and click on Import the Postman collection.

Import API from the file

You can choose the file or link to import the collection; as you select the Postman collection file, you will see all the requests inside that collection are imported.

Now, you can make API calls from your mobile phone itself.

Image from mobile

Conclusion

In this article, I explained everything about the Postman collection and its advantages; I have also shared about importing and exporting collections.

After following all the steps, you can create your own Postman collections, share them with others, and import others’ collections.

Have something to say? Get in touch with me via LinkedIn


Share this post


Read more articles...

team

How I Went Viral

team

Google Place Search in React

team

How to Setup AWS Authentication for React Applications

team

Add Custom Fonts with NextJS

Profile Image

Who I am

Hi, I amMohammad Faisal, A full-stack software engineer @Cruise , working remotely from a small but beautiful country named Bangladesh.

I am most experienced inReactJS,NodeJS andAWS

Buy Me a Coffee Widget