Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

Push queued changes

Admin or cashier. Replays a device’s queued sales, customer, supplier, medicine changes. Per-entity results sit in the 200 body, and a replayed client_mutation_id is deduped.

POST/api/v1/sync/push
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Request body
requiredapplication/json
device_idstringrequired
changesobject[]required
Show properties
Array of object
client_mutation_idstringrequired
entitystringrequired
opstringrequired
payloadobjectrequired
Responses
200

Accepted changes and per-entity rejections

acceptedobject[]required
Show properties
Array of object
client_mutation_idstringrequired
idstringrequired
icvinteger
min -9007199254740991 · max 9007199254740991
invoice_numberstring
rejectedobject[]required
Show properties
Array of object
client_mutation_idstringrequired
codestringrequired
messagestringrequired
400

Body must contain device_id and a changes array

detailstringrequired
401

Not authenticated

detailstringrequired
403

Caller's role is not allowed, the device belongs to another branch, or the device has been revoked

detailstringrequired
404

Unknown device

detailstringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/sync/push' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "device_id": "string",
  "changes": [
    {
      "client_mutation_id": "string",
      "entity": "string",
      "op": "string",
      "payload": {
        "property1": null,
        "property2": null
      }
    }
  ]
}'
Response
{
  "accepted": [
    {
      "client_mutation_id": "string",
      "id": "string",
      "icv": -9007199254740991,
      "invoice_number": "string"
    }
  ],
  "rejected": [
    {
      "client_mutation_id": "string",
      "code": "string",
      "message": "string"
    }
  ]
}