Skip to main content

Sync Endpoints

Sync Specific Entity

Sync a specific entity type (products, customers, brands, or categories).

Endpoint: POST /api/sync/[entityType]

Path Parameters:

  • entityType: One of products, customers, brands, categories

Request Body:

{
"incremental": true
}

Headers:

Authorization: Bearer YOUR_TOKEN_HERE
Content-Type: application/json

Response:

{
"success": true,
"data": {
"entityType": "products",
"syncType": "incremental",
"totalRecords": 1000,
"processedRecords": 1000,
"successRecords": 995,
"errorRecords": 5,
"startedAt": "2024-01-15T10:00:00Z",
"completedAt": "2024-01-15T10:15:00Z"
}
}

Sync All Entities

Sync all entity types in sequence.

Endpoint: POST /api/sync/all

Request Body:

{
"incremental": true
}

Response:

{
"success": true,
"data": {
"products": { ... },
"customers": { ... },
"brands": { ... },
"categories": { ... }
}
}

Get Sync Status

Get the current sync status for all entity types.

Endpoint: GET /api/sync/status

Response:

{
"success": true,
"data": {
"statuses": [
{
"entityType": "products",
"lastSync": {
"date": "2024-01-15T10:00:00Z",
"itemsSynced": 1000,
"errors": 0
},
"config": {
"incrementalSync": true
},
"unresolvedErrors": 0
}
]
}
}

Get Sync Progress

Get real-time progress of active syncs.

Endpoint: GET /api/sync/progress

Response:

{
"success": true,
"data": {
"progress": [
{
"id": "sync-123",
"entityType": "products",
"syncType": "incremental",
"status": "running",
"totalRecords": 1000,
"processedRecords": 450,
"successRecords": 445,
"errorRecords": 5,
"currentItem": {
"name": "Product ABC-123",
"action": "updating"
},
"startedAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:05:00Z"
}
]
}
}

Control Sync

Pause, resume, or stop an active sync.

Endpoint: POST /api/sync/control

Request Body:

{
"entityType": "products",
"action": "pause" // or "resume" or "stop"
}

Response:

{
"success": true,
"data": {
"message": "Sync paused successfully"
}
}