Step-by-step: building a Postman collection from scratch
Prerequisites
- Download and install Postman
- Ensure your Spring Boot API is running:
./mvnw spring-boot:run - Verify API is responding:
curl http://localhost:8080/customers
Phase 1: Initial Postman setup
1. Create new workspace
- Open Postman
- Click Workspaces → Create Workspace
- Name:
API Documentation Projects - Description:
Collections for technical writing showcases - Visibility: Personal (for now)
- Click Create
2. Create new collection
- In your workspace, click New → Collection
- Name:
Customer Management API - Description:
Complete collection for testing the Customer Management REST API. Demonstrates CRUD operations, batch processing, search functionality, and error handling. - Click Create
3. Set up environment
- Click Environments → Create Environment
- Name:
Development - Add variables:
Variable: baseUrl Initial Value: http://localhost:8080 Current Value: http://localhost:8080 Variable: customerID Initial Value: CUST001 Current Value: CUST001 Variable: adminUsername Initial Value: testadmin Current Value: testadmin Variable: adminPassword Initial Value: admin123 Current Value: admin123 - Click Save
- Select the Development environment in the top-right dropdown
Phase 2: Build the collection structure
1. Create folder structure
Right-click on your collection → Add Folder
Folder 1:
- Name:
Single Customer CRUD Operations - Description:
Individual customer management operations
Folder 2:
- Name:
Multiple Customer Operations - Description:
Batch and search operations
Folder 3:
- Name:
Error Testing - Description:
Test error conditions and edge cases
Phase 3: Add requests - Single Customer CRUD
Request 1: Create Customer (POST)
- Right-click
Single Customer CRUD Operations→ Add Request - Request Name:
Create Customer - Method:
POST - URL:
/customer - Headers:
- Key:
Content-Type, Value:application/json
- Key:
- Body: Select
raw→JSON, paste:{ "name": "Alice Johnson", "id": "", "phone": "555-0123", "type": "VIP", "address": { "street": "123 Main St", "city": "New York", "state": "NY", "zipCode": "10001", "country": "USA" } } - Save the request
Request 2: Get Customer by ID (GET)
- Add new request to same folder
- Request Name:
Get Customer by ID - Method:
GET - URL:
/customer/ - Headers:
- Key:
Accept, Value:application/json
- Key:
- Save
Request 3: Update Customer (PUT)
- Add new request
- Request Name:
Update Customer (PUT) - Method:
PUT - URL:
/customer - Headers:
- Key:
Content-Type, Value:application/json
- Key:
- Body:
raw→JSON:{ "name": "Alice Johnson Updated", "id": "", "phone": "555-9999", "type": "PREMIUM", "address": { "street": "456 Updated Ave", "city": "New York", "state": "NY", "zipCode": "10002", "country": "USA" } } - Save
Request 4: Partial Update (PATCH)
- Add new request
- Request Name:
Partial Update Customer (PATCH) - Method:
PATCH - URL:
/customer/ - Headers:
- Key:
Content-Type, Value:application/json
- Key:
- Body:
raw→JSON:{ "phone": "555-PATCH", "type": "BUSINESS" } - Save
Authentication setup
The Customer Management API uses HTTP Basic Authentication for protected endpoints. DELETE operations require ADMIN role authentication.
Setting up authentication
Method 1: Collection-level authentication (Recommended)
- Right-click your collection → Edit
- Go to the Authorization tab
- Type: Select
Basic Auth - Username: ``
- Password: ``
- Click Save
This applies authentication to ALL requests in the collection. Individual requests can override this if needed.
Method 2: Individual request authentication For requests that need authentication (like DELETE), you can set it per request:
- Open the request → go to Authorization tab
- Type: Select
Basic Auth - Username: ``
- Password: ``
Request 5: Delete Customer (DELETE)
- Add new request
- Request Name:
Delete Customer (Admin Only) - Method:
DELETE - URL:
/customer/ - Authorization: (If not set at collection level)
- Go to Authorization tab
- Type:
Basic Auth - Username: ``
- Password: ``
- No additional headers or body needed
- Save
Note: This request requires ADMIN role. Without authentication, it will return 401 Unauthorized.
Phase 4: Add requests - Multiple Customer Operations
Request 6: Batch Create
- Right-click
Multiple Customer Operations→ Add Request - Request Name:
Batch Create Customers - Method:
POST - URL:
/customers/batch - Headers:
- Key:
Content-Type, Value:application/json
- Key:
- Body:
raw→JSON:[ { "name": "Bob Smith", "id": "CUST002", "phone": "555-0124", "type": "BUSINESS", "address": { "street": "456 Oak Ave", "city": "Boston", "state": "MA", "zipCode": "02101", "country": "USA" } }, { "name": "Carol Davis", "id": "CUST003", "phone": "555-0125", "type": "INDIVIDUAL", "address": { "street": "789 Pine St", "city": "Seattle", "state": "WA", "zipCode": "98101", "country": "USA" } } ] - Save
Request 7: Get All Customers
- Add new request
- Request Name:
Get All Customers (Paginated) - Method:
GET - URL:
/customers - Params: (Postman will add these to URL automatically)
- Key:
page, Value:0 - Key:
size, Value:10
- Key:
- Headers:
- Key:
Accept, Value:application/json
- Key:
- Save
Request 8: Search by Name
- Add new request
- Request Name:
Search Customers - by Name - Method:
GET - URL:
/customers/search - Params:
- Key:
name, Value:Alice - Key:
page, Value:0 - Key:
size, Value:10
- Key:
- Headers:
- Key:
Accept, Value:application/json
- Key:
- Save
Request 9: Search by Type
- Add new request
- Request Name:
Search Customers - by Type - Method:
GET - URL:
/customers/search - Params:
- Key:
type, Value:VIP - Key:
page, Value:0 - Key:
size, Value:10
- Key:
- Save
Request 10: Search by Location
- Add new request
- Request Name:
Search Customers - by Location - Method:
GET - URL:
/customers/search - Params:
- Key:
city, Value:New York - Key:
state, Value:NY - Key:
page, Value:0Our - Key:
size, Value:10
- Key:
- Save
Phase 5: Add error testing requests
Request 11: Test 404 Error
- Right-click
Error Testing→ Add Request - Request Name:
Get Non-existent Customer (404) - Method:
GET - URL:
/customer/NONEXISTENT - Headers:
- Key:
Accept, Value:application/json
- Key:
- Save
Request 12: Test 400 Error
- Add new request
- Request Name:
Create Customer - Invalid Data (400) - Method:
POST - URL:
/customer - Headers:
- Key:
Content-Type, Value:application/json
- Key:
- Body:
raw→JSON:{ "name": "", "id": "", "type": "INVALID_TYPE" } - Save
Request 13: Test Authentication Error (401)
- Add new request
- Request Name:
Delete Customer - No Auth (401) - Method:
DELETE - URL:
/customer/ - Authorization: Select
No Auth(this overrides collection-level auth) - Save
This request demonstrates what happens when you try to access a protected endpoint without proper authentication.
Phase 6: Test your collection
1. Test the happy path
- First: Run
Create Customer- should return “Customer added successfully” - Then: Run
Get Customer by ID- should return customer data - Then: Run
Get All Customers- should show your customer in the list - Then: Run
Search by Namewith name=Alice - should find your customer
2. Test updates
- Run
Partial Update Customer (PATCH)- should update phone and type - Run
Get Customer by IDagain - verify changes took effect - Run
Update Customer (PUT)- should replace entire customer - Run
Get Customer by IDagain - verify full replacement
3. Test batch and search
- Run
Batch Create Customers- should create multiple customers - Run
Get All Customers- should show multiple customers now - Try different search requests with various filters
4. Test error conditions
- Run
Get Non-existent Customer (404)- should return 404 error - Run
Create Customer - Invalid Data (400)- should return validation error - Run
Delete Customer - No Auth (401)- should return 401 Unauthorized error
5. Test authentication
- Test DELETE with Authentication:
- Ensure collection-level authentication is set OR individual DELETE request has auth configured
- Run
Delete Customer (Admin Only)- should return “Customer deleted successfully”
- Test DELETE without Authentication:
- Temporarily disable authentication on the DELETE request:
- Go to request Authorization tab
- Type: Select
No Auth
- Run the request - should return
401 Unauthorized - Re-enable authentication after testing
- Temporarily disable authentication on the DELETE request:
- Verify Environment Variables:
- Check that `` resolves to
testadmin - Check that `` resolves to
admin123 - You can see resolved values in the request preview
- Check that `` resolves to
Phase 7: Add pre-request scripts (Advanced)
1. Collection-level script
- Right-click collection → Edit
- Go to Pre-request Script tab
- Add this script:
// Generate unique customer ID for testing pm.globals.set('customerID', 'CUST' + Math.floor(Math.random() * 1000).toString().padStart(3, '0')); // Set timestamp for testing pm.globals.set('timestamp', new Date().toISOString()); console.log('Generated Customer ID:', pm.globals.get('customerID')); - Save
2. Test with dynamic IDs
- Run
Create Customer- check Console (View → Show Postman Console) to see generated ID - Update your
Get Customer by IDrequest to use the dynamic ID if needed
Phase 8: Export your collection
1. Export collection
- Right-click your collection → Export
- Choose Collection v2.1 (recommended)
- Export and save as
Customer-Management-API.postman_collection.json
2. Export environment
- Go to Environments → Click the Development environment
- Click … → Export
- Save as
Development.postman_environment.json
3. Share your work
Now you have two files to share:
Customer-Management-API.postman_collection.json- The requestsDevelopment.postman_environment.json- The environment variables
Others can import both files to get your complete setup.
Phase 9: Documentation integration
1. Generate documentation
- Click your collection → View Documentation
- Publish to create shareable docs
- Or Export as HTML for offline documentation
2. Add request descriptions
For each request, click … → Edit → Add detailed descriptions:
Example for Create Customer:
Creates a new customer with complete profile information.
**Features demonstrated:**
- Nested object handling (Address within Customer)
- Enum validation (CustomerType)
- Input validation and error handling
**Required fields:**
- name: Customer full name
- id: Unique customer identifier (format: CUSTXXX)
- type: Customer type (INDIVIDUAL, BUSINESS, VIP, PREMIUM)
**Optional fields:**
- phone: Contact phone number
- address: Complete address object
Pro tips for technical writers:
1. Organize requests logically
- Group by functionality (CRUD, Search, Batch)
- Order by typical workflow (Create → Read → Update → Delete)
- Include error cases in separate folder
2. Use environment variables
- `` for different environments (dev, staging, prod)
- `` for reusable test data
andfor authentication credentials- `` for JWT tokens (when applicable)
3. Add comprehensive testing
- Test both success and failure scenarios
- Include edge cases (empty data, invalid formats)
- Test all parameter combinations
- Test authentication: both authenticated and unauthenticated requests
- Test authorization: verify role-based access control works correctly
4. Document everything
- Add descriptions to requests explaining what they test
- Include example responses
- Document required vs optional fields
5. Keep collections updated
- Re-export after changes
- Version your collections (v1.0, v1.1, etc.)
- Test collections regularly to ensure API changes don’t break them
This workflow gives you a professional Postman collection that demonstrates thorough API testing skills - exactly what technical writing positions look for!