API Sync Endpoints Reference
This document covers the sync endpoints for ERP integration with Eryxon MES.
Authentication
Section titled “Authentication”All requests require an API key in the Authorization header:
Authorization: Bearer ery_live_your_api_key_hereJobs Sync
Section titled “Jobs Sync”Single Job Sync
Section titled “Single Job Sync”PUT /api-jobs/syncContent-Type: application/jsonRequest Body:
{ "external_id": "SO-12345", "external_source": "SAP", "job_number": "JOB-2024-001", "customer": "Acme Corp", "due_date": "2024-12-31", "priority": 5, "notes": "Synced from SAP"}With Nested Parts & Operations:
{ "external_id": "SO-12345", "external_source": "SAP", "job_number": "JOB-2024-001", "customer": "Acme Corp", "parts": [ { "external_id": "SO-12345-10", "part_number": "BRACKET-A", "material": "Steel 304", "quantity": 25, "operations": [ { "external_id": "SO-12345-10-010", "operation_name": "Laser Cut", "cell_name": "Cutting", "sequence": 1, "estimated_time_minutes": 30 }, { "external_id": "SO-12345-10-020", "operation_name": "Bend 90°", "cell_name": "Bending", "sequence": 2, "estimated_time_minutes": 15 } ] } ]}Response (201 Created / 200 Updated):
{ "success": true, "data": { "action": "created", "id": "550e8400-e29b-41d4-a716-446655440000", "external_id": "SO-12345" }}Bulk Jobs Sync
Section titled “Bulk Jobs Sync”POST /api-jobs/bulk-syncContent-Type: application/jsonRequest Body:
{ "jobs": [ { "external_id": "SO-001", "external_source": "SAP", "job_number": "JOB-001", "customer": "Customer A" }, { "external_id": "SO-002", "external_source": "SAP", "job_number": "JOB-002", "customer": "Customer B" } ]}Response:
{ "success": true, "data": { "total": 2, "created": 1, "updated": 1, "errors": 0, "results": [ { "external_id": "SO-001", "id": "uuid-1", "action": "created" }, { "external_id": "SO-002", "id": "uuid-2", "action": "updated" } ] }}Parts Sync
Section titled “Parts Sync”Single Part Sync
Section titled “Single Part Sync”PUT /api-parts/syncContent-Type: application/jsonRequest Body:
{ "external_id": "SO-12345-10", "external_source": "SAP", "job_external_id": "SO-12345", "part_number": "BRACKET-A", "material": "Steel 304", "quantity": 25, "notes": "Handle with care"}Note:
job_external_idis required to link the part to its parent job.
Bulk Parts Sync
Section titled “Bulk Parts Sync”POST /api-parts/bulk-syncContent-Type: application/json{ "parts": [ { "external_id": "SO-001-10", "external_source": "SAP", "job_external_id": "SO-001", "part_number": "PART-A", "quantity": 10 } ]}Operations Sync
Section titled “Operations Sync”Single Operation Sync
Section titled “Single Operation Sync”PUT /api-operations/syncContent-Type: application/jsonRequest Body:
{ "external_id": "SO-12345-10-010", "external_source": "SAP", "part_external_id": "SO-12345-10", "operation_name": "Laser Cut", "cell_name": "Cutting", "sequence": 1, "estimated_time_minutes": 30, "notes": "Use 1000W laser"}Note:
part_external_idandcell_nameare required.
Bulk Operations Sync
Section titled “Bulk Operations Sync”POST /api-operations/bulk-syncContent-Type: application/jsonCells Sync
Section titled “Cells Sync”Single Cell Sync
Section titled “Single Cell Sync”PUT /api-cells/syncContent-Type: application/jsonRequest Body:
{ "external_id": "WC-CUTTING", "external_source": "SAP", "name": "Cutting", "color": "#3b82f6", "sequence": 1, "active": true}Bulk Cells Sync
Section titled “Bulk Cells Sync”POST /api-cells/bulk-syncContent-Type: application/jsonResources Sync
Section titled “Resources Sync”Single Resource Sync
Section titled “Single Resource Sync”PUT /api-resources/syncContent-Type: application/jsonRequest Body:
{ "external_id": "TOOL-001", "external_source": "SAP", "name": "CNC Mill #1", "type": "equipment", "description": "5-axis CNC milling machine", "identifier": "MILL-001", "location": "Building A, Bay 3", "status": "available"}Resource Types:
toolingfixturemoldmaterialequipment
Status Values:
availablein_usemaintenance
Bulk Resources Sync
Section titled “Bulk Resources Sync”POST /api-resources/bulk-syncContent-Type: application/jsonError Handling
Section titled “Error Handling”Validation Error
Section titled “Validation Error”{ "success": false, "error": { "code": "VALIDATION_ERROR", "message": "external_id is required for sync operations" }}Bulk Sync with Errors
Section titled “Bulk Sync with Errors”{ "success": true, "data": { "total": 3, "created": 1, "updated": 1, "errors": 1, "results": [ { "external_id": "SO-001", "id": "uuid-1", "action": "created" }, { "external_id": "SO-002", "id": "uuid-2", "action": "updated" }, { "external_id": "SO-003", "action": "error", "error": "Invalid due_date format" } ] }}Rate Limits
Section titled “Rate Limits”- Bulk sync: Maximum 1000 records per request
- Rate limiting headers are included in responses:
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset
Sync Order Recommendations
Section titled “Sync Order Recommendations”For initial sync, follow this order to satisfy foreign key relationships:
- Cells (Work Centers) - No dependencies
- Resources (Equipment) - No dependencies
- Jobs (Sales Orders) - No dependencies
- Parts (Work Orders) - Requires job_external_id
- Operations (Routing Steps) - Requires part_external_id and cell_name