Traceability Records
| Method | Path | Description |
|---|---|---|
GET | /api/traceability | List records |
POST | /api/traceability | Create a record |
PATCH | /api/traceability/{id} | Update a record |
Processing Stages
| Method | Path | Description |
|---|---|---|
GET | /api/processing-stages | List all stages |
POST | /api/processing-stages | Create a stage |
PATCH | /api/processing-stages/{id} | Update a stage |
POST | /api/processing-stages/bulk | Bulk upsert stages |
POST /api/traceability
Shell
curl -X POST http://localhost:8080/api/traceability \-H "Content-Type: application/json" \-d '{ "company_product_id": 3, "status": "DRAFT" }'
POST /api/processing-stages/bulk
JSON
{"stages": [{ "traceability_id": 10, "stage_name": "Spinning", "stage_order": 1, "country_code": "IN" },{ "traceability_id": 10, "stage_name": "Dyeing", "stage_order": 2, "country_code": "BD", "distance_km": 2200, "co2_kg": 0.18 }]}
After bulk insert, ProductTraceability.total_distance_km and total_co2_kg are automatically recalculated.