← Back to Chapters

Collections in Postman

? Collections in Postman

? Quick Overview

Collections in Postman are structured containers used to store, organize, and manage API requests. They help developers and testers group related requests, apply common configurations, and collaborate efficiently.

? Key Concepts

  • Collections group multiple API requests together
  • Folders organize requests inside collections
  • Variables can be scoped at the collection level
  • Collections can be shared and versioned

? Syntax / Theory

A Postman collection follows a hierarchical structure:

  • Collection (Top-level container)
  • Folders (Optional grouping)
  • Requests (API calls like GET, POST, PUT, DELETE)

? Code Example(s)

? View Code Example
// Sample Postman collection structure in JSON
{
"name": "User API Collection",
"item": [
{
"name": "Get Users",
"request": {
"method": "GET",
"url": "https://api.example.com/users"
}
}
]
}

?️ Live Output / Explanation

This collection contains a single request named Get Users. When executed in Postman, it sends a GET request to the specified endpoint and returns user data.

? Interactive Example / Visual Explanation

Imagine a folder structure like a file system. Click the rows below to expand/collapse the structure, just like in Postman:

? User API Collection
? Auth
POST Login Request
? Users
GET Get All Users
POST Create User
PUT Update Profile
DEL Delete Account

 

  • ? User API Collection is the main container.
  • ? Auth and Users are folders organizing specific logic.
  • ? Individual lines are specific API endpoints (Requests).

 

? Use Cases

  • Organizing large API projects
  • Sharing APIs with teams
  • Automated testing using collection runner
  • Maintaining environment-specific requests

✅ Tips & Best Practices

  • Use meaningful collection and folder names
  • Group requests by feature or module
  • Store common variables at collection level
  • Export collections for backup and sharing

? Try It Yourself

  • Create a new collection in Postman
  • Add folders for different API modules
  • Insert at least 3 requests inside folders
  • Run the collection using Collection Runner