Procurement Domain - Examples
Last Updated: 2026-07-09
Request/response examples for common procurement workflows.
Creating a Supplier
POST /suppliers/
curl -X POST /suppliers/ \
-H "Authorization: Token <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Wholesale",
"supplier_code": "SUP-001",
"payment_terms": "net_30",
"lead_time_days": 7,
"minimum_order_amount": "500.00",
"account_number": "ACM-789012",
"contacts": [
{
"name": "Jane Smith",
"email": "[email protected]",
"phone": "+1-555-0100",
"role": "Account Manager"
}
],
"address": {
"street": "123 Warehouse Way",
"city": "Chicago",
"state": "IL",
"postal_code": "60601",
"country": "US"
}
}'
Response (201 Created):
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"sanity_id": "",
"name": "Acme Wholesale",
"supplier_code": "SUP-001",
"tax_identification": "",
"is_active": true,
"payment_terms": "net_30",
"lead_time_days": 7,
"minimum_order_amount": "500.00",
"account_number": "ACM-789012",
"contacts": [...],
"address": {...},
"created_at": "2026-02-24T10:00:00Z",
"updated_at": "2026-02-24T10:00:00Z"
}
Creating a Purchase Order
POST /purchase-orders/
curl -X POST /purchase-orders/ \
-H "Authorization: Token <token>" \
-H "Content-Type: application/json" \
-d '{
"po_number": "PO-2026-001",
"supplier": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"expected_date": "2026-03-15",
"status": "Pending",
"total_cost": "1250.00",
"notes": "Reorder triggered by low stock alert on SKU-A100"
}'
Response (201 Created):
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"sanity_id": "",
"po_number": "PO-2026-001",
"supplier": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"supplier_name": "Acme Wholesale",
"supplier_code": "SUP-001",
"expected_date": "2026-03-15",
"status": "Pending",
"items": [],
"total_cost": "1250.00",
"received_date": null,
"notes": "Reorder triggered by low stock alert on SKU-A100",
"line_items": [],
"created_at": "2026-02-24T10:05:00Z",
"updated_at": "2026-02-24T10:05:00Z"
}
Advancing PO Status (Receiving Stock)
Update a PO status to Partially Received when a partial shipment arrives:
PATCH /purchase-orders/{id}/
curl -X PATCH /purchase-orders/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
-H "Authorization: Token <token>" \
-H "Content-Type: application/json" \
-d '{
"status": "Partially Received"
}'
Mark as fully received when the remainder arrives:
curl -X PATCH /purchase-orders/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
-H "Authorization: Token <token>" \
-H "Content-Type: application/json" \
-d '{
"status": "Received",
"received_date": "2026-03-14"
}'
Fetching Open Purchase Orders
List all POs that are not yet fully received or cancelled:
GET /purchase-orders/?status=Pending
GET /purchase-orders/?status=Submitted
GET /purchase-orders/?status=Partially%20Received
Or combine with supplier filter:
GET /purchase-orders/?supplier=f47ac10b-58cc-4372-a567-0e02b2c3d479&status=Submitted
Procurement Summary Analytics
GET /purchase-orders/analytics/summary/?start_date=2026-01-01&end_date=2026-02-24
{
"total_purchase_orders": 18,
"total_po_value": "22750.00",
"by_status": [
{"status": "Cancelled", "count": 1, "value": "500.00"},
{"status": "Partially Received", "count": 2, "value": "3000.00"},
{"status": "Pending", "count": 3, "value": "4250.00"},
{"status": "Received", "count": 11, "value": "14000.00"},
{"status": "Submitted", "count": 1, "value": "1000.00"}
],
"open_po_count": 6,
"open_po_value": "8250.00"
}
Supplier Performance Analytics
GET /suppliers/analytics/performance/?start_date=2026-01-01&end_date=2026-02-24
{
"data": [
{
"supplier_name": "Acme Wholesale",
"supplier_code": "SUP-001",
"stated_lead_time": 7,
"total_orders": 8,
"total_value": "12000.00",
"received_count": 7,
"active_pos": 1
},
{
"supplier_name": "Global Imports",
"supplier_code": "SUP-002",
"stated_lead_time": 14,
"total_orders": 5,
"total_value": "6500.00",
"received_count": 4,
"active_pos": 1
}
]
}