Postman collection export guide

Postman collection export guide

Complete instructions for exporting and sharing Postman collections for the Customer Management API.

Export your Postman collection

Step-by-step export process

1. Export Main Collection

Postman Desktop App:
1. Right-click your collection (e.g., "Customer Management API")
2. Select "Export"
3. Choose "Collection v2.1" (recommended format)
4. Click "Export"
5. Save as: api-assets/postman/Customer-Management-API.postman_collection.json

2. Export Environment Variables

Environment Export:
1. Go to "Environments" tab (left sidebar)
2. Click "..." menu next to your environment (e.g., "Development")
3. Select "Export"
4. Save as: api-assets/postman/Development.postman_environment.json

3. Export Additional Environments (Optional)

# If you have multiple environments:
Production.postman_environment.json    # Production API URLs
Staging.postman_environment.json      # Staging environment
Local.postman_environment.json        # Local development

File naming conventions

Collections:

Good: Good naming:
Customer-Management-API.postman_collection.json
REST-Demo-API-v1.postman_collection.json

Avoid: Avoid:
collection.json
export.json
untitled.postman_collection.json

Environments:

Good: Good naming:
Development.postman_environment.json
Production.postman_environment.json
Local.postman_environment.json

Avoid: Avoid:
env.json
environment.json
api-assets/
├── README.md                                          # Usage instructions
├── postman/
│   ├── Customer-Management-API.postman_collection.json    # Main collection
│   ├── Development.postman_environment.json              # Dev environment
│   ├── Production.postman_environment.json               # Prod environment
│   └── USAGE.md                                          # Postman-specific instructions
├── openapi/
│   ├── customer-api.yaml                                 # Current API spec
│   └── practice-exercise.yaml                            # Learning template
└── examples/
    ├── requests/                                         # Sample requests
    └── responses/                                        # Sample responses

Collection organization best practices

Organizing your collection logically makes it easier for team members to understand and use your API tests.

Folder structure in Postman

Customer Management API/
├── - Single Customer CRUD Operations/
│   ├── Create Customer (POST)
│   ├── Update Customer (PUT)
│   ├── Partial Update (PATCH)
│   ├── Get Customer (GET)
│   └── Delete Customer (DELETE)
├── - Multiple Customer Operations/
│   ├── Get All Customers (GET)
│   ├── Search Customers (GET)
│   └── Batch Create (POST)
└── - Error Testing/
    ├── Get Non-existent Customer (404)
    └── Create Invalid Customer (400)

Environment variables setup

{
  "name": "Development",
  "values": [
    {
      "key": "baseUrl",
      "value": "http://localhost:8080",
      "enabled": true
    },
    {
      "key": "customerId",
      "value": "CUST001",
      "enabled": true
    },
    {
      "key": "apiVersion",
      "value": "v1",
      "enabled": true
    }
  ]
}

Quick commands for export

Export current API specification

# Export latest OpenAPI spec
curl -s http://localhost:8080/v3/api-docs.yaml > api-assets/openapi/customer-api.yaml

# Create timestamped backup
curl -s http://localhost:8080/v3/api-docs.yaml > "api-assets/openapi/customer-api-$(date +%Y%m%d).yaml"

Verify exports

# Check file sizes (should not be empty)
ls -la api-assets/postman/*.json

# Validate JSON format
jq empty api-assets/postman/*.json && echo "Good: Valid JSON" || echo "Avoid: Invalid JSON"

Team sharing instructions

Follow these steps to help team members import and use your Postman collection effectively.

For new team members

Share these files:

  1. Customer-Management-API.postman_collection.json - Main collection
  2. Development.postman_environment.json - Environment setup
  3. api-assets/README.md - Usage instructions

Import Instructions:

1. Open Postman
2. Click "Import" (top-left)
3. Drag & drop both JSON files
4. Select "Development" environment (top-right dropdown)
5. Ensure API is running: ./mvnw spring-boot:run
6. Start testing!

Version control integration

# Add to git
git add api-assets/postman/*.json
git add api-assets/README.md
git commit -m "Add Postman collection and environment for API testing"

# Create release tag
git tag -a "postman-v1.0" -m "Initial Postman collection release"
git push origin postman-v1.0

Maintenance workflow

Keep your Postman collections updated as your API evolves to maintain their value for testing and documentation.

When API changes

  1. Update requests in Postman with new endpoints/parameters
  2. Test all requests to ensure they work
  3. Re-export collection:
    Right-click collection → Export → Collection v2.1
    Replace: api-assets/postman/Customer-Management-API.postman_collection.json
    
  4. Update environment if new variables needed
  5. Commit changes to version control

Collection versioning strategy

# Semantic versioning for collections
Customer-Management-API-v1.0.postman_collection.json  # Major API version
Customer-Management-API-v1.1.postman_collection.json  # Minor updates
Customer-Management-API-v2.0.postman_collection.json  # Breaking changes

# Or use git tags
git tag -a "collection-v1.1" -m "Updated collection with new search parameters"

Pro tips for technical writers

Collection Enhancement Features

// Add to request Pre-request Script for dynamic data
pm.globals.set("timestamp", new Date().toISOString());
pm.globals.set("randomId", "CUST" + Math.floor(Math.random() * 1000));

// Add to request Tests for response validation
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Response has required fields", function () {
    const jsonData = pm.response.json();
    pm.expect(jsonData).to.have.property('id');
    pm.expect(jsonData).to.have.property('name');
});

Documentation Integration

  • Add request descriptions that match OpenAPI documentation
  • Include example scenarios in request names
  • Link to API docs in collection description
  • Document expected responses in request descriptions

Testing scenarios to include

Good: Happy Path Tests:
- Create → Read → Update → Delete workflow
- Successful search with various filters
- Batch operations with valid data

Good: Error Condition Tests:
- Invalid customer IDs (404 errors)
- Missing required fields (400 errors)
- Invalid enum values (400 errors)
- Duplicate customer creation (409 errors)

Good: Edge Case Tests:
- Empty search results
- Pagination boundaries
- Maximum batch sizes

Result: A professional Postman collection that showcases API testing skills and provides immediate value to developers and testers.

Your export location

Save your exported files to:

/path/to/your/project/api-assets/postman/

The directory structure is ready and waiting for your Postman exports.