Open In App

What are Postman Collections, and how do they organize requests?

Last Updated : 08 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Postman is a popular tool for working with APIs. It’s user-friendly and has a cool feature called Collections. In this article, we will talk about what Collections are and how they help you organize and manage your API requests efficiently.

Prerequisites

We will discuss the following two approaches to organize requests in Postman Collections:

Postman Collections are a very useful feature of Postman that simplifies containers or folders which helps to organize and structure your API requests. Instead of dealing with individual requests, Collections allows you to group related requests.

Benefits of Postman Collections

  • Organization: By using the collections we can organize requests, which makes it easier to navigate and understand the API structure.
  • Reusability: All the requests within collections can be reused across different scenarios, which increases efficiency.
  • Collaboration: Collections can be shared among team members so that they can use the same set of requests for testing.

Let suppose you are working on an e-commerce API that includes various endpoints for user authentication, product management, and order processing. Instead of having a list of requests, you can create separate Collections for each of these categories.

This way, all requests related to user authentication can be grouped within a “User Authentication” Collection, making it easy to locate and manage them.

Example:

Requests:

  • Login
  • Logout
  • Refresh Token
Screenshot-2566-12-31-at-110048

User Authentication Collection

Approach 2: Sequencing Requests:

Collections define the order in which requests will be executed. This is particularly useful when your API calls need to be performed in a specific sequence.

For instance, you might have a sequence of requests for user registration, login, and profile retrieval. By organizing these requests into a Collection, you ensure that they are executed in the correct order.

Example:

Collection Name: User Registration

Requests:

  • Register User
  • Login User
  • Get User Profile
Screenshot-2566-12-31-at-110424

Sequence of Requests

Creating a Postman Collection

Step 1: Open Postman:Launch the Postman application on your machine.

Screenshot-2566-12-31-at-110604

Postman initial window

Step 2: Create a New Collection:

Select “Collection” on top-left and Click on Plus button.

Screenshot-2566-12-31-at-110628

Click on Plus button to make a new collection

Step 3: Give your collection a descriptive name.

Screenshot-2566-12-31-at-110830-(1)

Naming of collection

Step 4: Within the collection, you can start adding requests by clicking on the “Add Request” button.

Screenshot-2566-12-31-at-110944

Add request button

Step 5. Organize with Folders (Optional):

To create folders within your collection, click on the “Add Folder” button.

Screenshot-2566-12-31-at-111112

Adding a new folder to organise similar requests

Screenshot-2566-12-31-at-111323

User profile related requests within Profile folder

Step 6. Save Your Collection:

Your Collection is automatically saved. Now you can test your endpoints.

Output:

Untitled-design-(23)

Creating User Registration Collection



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads