Offline Sync API Reference
API endpoints untuk batch synchronization dan conflict resolution dalam offline-first architecture.🔐 Authentication
Semua endpoint memerlukan JWT authentication token.📡 Endpoints
1. Batch Sync
Sync multiple transactions, payments, dan voids dalam satu request.Request Body
array
required
Array of offline transactions to sync
array
default:"[]"
Array of offline payments to sync
array
default:"[]"
Array of offline voids to sync
string
required
Device identifier
datetime
required
ISO 8601 timestamp when sync initiated
Response (Success)
integer
HTTP status code (200)
object
Response Example
Response (With Conflict)
Error Responses
2. Resolve Conflict
Resolve detected conflict dengan strategy tertentu.Path Parameters
string
required
Conflict ID from batch sync response
Request Body
string
required
Resolution strategy:
keep_server: Keep server data, discard localkeep_local: Keep local data, overwrite server (not yet implemented)merge: Merge both data (not yet implemented)
object
Required if strategy is “merge”
Response (Success)
Error Responses
🔄 Sync Flow Diagram
📊 Rate Limiting
💡 Best Practices
Batch Size
Retry Logic
Idempotency
Gunakan
offline_reference sebagai idempotency key. Server akan detect duplicate dan return existing data.Error Handling
🧪 Testing
Postman Collection
Download Postman collection: offline-sync-api.postman_collection.jsonREST Client Examples
See complete examples in:api/pos/offline-sync.http
📚 Related Documentation
Backend Implementation
Complete backend guide
Flutter Implementation
Step-by-step Flutter guide
Transaction Flow
Transaction state machine
Error Codes
Complete error codes reference
🆘 Support
Need Help?
- Backend Team: [email protected]
- Documentation: GitHub Wiki
- Issues: GitHub Issues