Quick reference: Postman request data

Quick reference: Postman request data

Use this as a copy-paste reference when building your Postman collection manually.

Environment variables

Variable: baseUrl
Value: http://localhost:8080

Variable: customerId
Value: CUST001

Request bodies (JSON)

1. Create Customer (POST /customer)

{
  "name": "Alice Johnson",
  "id": "",
  "phone": "555-0123",
  "type": "VIP",
  "address": {
    "street": "123 Main St",
    "city": "New York",
    "state": "NY",
    "zipCode": "10001",
    "country": "USA"
  }
}

2. Update Customer (PUT /customer)

{
  "name": "Alice Johnson Updated",
  "id": "",
  "phone": "555-9999",
  "type": "PREMIUM",
  "address": {
    "street": "456 Updated Ave",
    "city": "New York",
    "state": "NY",
    "zipCode": "10002",
    "country": "USA"
  }
}

3. Partial Update (PATCH /customer/)

{
  "phone": "555-PATCH",
  "type": "BUSINESS"
}

4. Batch Create (POST /customers/batch)

[
  {
    "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"
    }
  }
]

5. Invalid Data Test (POST /customer)

{
  "name": "",
  "id": "",
  "type": "INVALID_TYPE"
}

URLs by request

Single Customer CRUD

POST   /customer
GET    /customer/
PUT    /customer
PATCH  /customer/
DELETE /customer/

Multiple Customer Operations

POST /customers/batch
GET  /customers?page=0&size=10
GET  /customers/search?name=Alice&page=0&size=10
GET  /customers/search?type=VIP&page=0&size=10
GET  /customers/search?city=New York&state=NY&page=0&size=10

Error Testing

GET  /customer/NONEXISTENT
POST /customer (with invalid JSON body)
POST /customers/batch (with empty array [])

Headers

For JSON Requests (POST, PUT, PATCH)

Content-Type: application/json
Accept: application/json

Pre-request 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'));

Testing workflow order

  1. Create Customer → Should return “Customer added successfully”
  2. Get Customer by ID → Should return customer JSON
  3. Batch Create → Should create multiple customers
  4. Get All Customers → Should show multiple customers
  5. Search by Name → Should find specific customers
  6. Partial Update → Should update specific fields
  7. Get Customer by ID → Should show updated data
  8. Delete Customer → Should remove customer
  9. Get Non-existent Customer → Should return 404 error

Query parameters quick reference

Pagination (for /customers and /customers/search)

page: 0 (page number, 0-based)
size: 10 (items per page, 1-100)

Search filters (for /customers/search)

name: Alice (partial match, case-insensitive)
type: VIP (exact match: INDIVIDUAL, BUSINESS, VIP, PREMIUM)
city: New York (partial match, case-insensitive)
state: NY (partial match, case-insensitive)

Expected response examples

Successful create response

Customer added successfully

Successful get response

{
  "name": "Alice Johnson",
  "id": "CUST001",
  "phone": "555-0123",
  "type": "VIP",
  "address": {
    "street": "123 Main St",
    "city": "New York",
    "state": "NY",
    "zipCode": "10001",
    "country": "USA",
    "formattedAddress": "123 Main St, New York, NY 10001, USA"
  },
  "businessCustomer": false,
  "highValueCustomer": true,
  "city": "New York"
}

Paginated response (Search/Get All)

{
  "content": [...],
  "page": 0,
  "size": 10,
  "totalPages": 1,
  "totalElements": 3,
  "first": true,
  "last": true,
  "empty": false,
  "nextPage": 0,
  "previousPage": 0,
  "numberOfElements": 3
}

404 error response

Customer not found

Use this reference to quickly build your collection without typing errors!