Push Orders Page
The Push Orders Page operation initializes the upstream synchronization process and sends order data from the external system to Talk2Sync.
Before sending orders, the daemon must determine the current upstream status, synchronization strategy, requested entity, and cursor position. It must then initialize the upstream process and select the appropriate endpoint depending on whether Talk2Sync requests a health-check sample or the complete order dataset.
1. Check the Upstream State
First, retrieve the current upstream connection status:
GET https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/upstreamstatus
A response should have a structure similar to:
{
"connectionstatus": "waiting"
}
The waiting status indicates that the upstream process is ready to be initialized.
2. Check the Synchronization Strategy
Retrieve the synchronization strategy requested by Talk2Sync:
GET https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/strategy
The response can be:
{
"strategy": "push"
}
or:
{
"strategy": "pingsample"
}
The strategy determines whether the daemon must send the complete dataset or only a sample for health-check purposes.
push— Send the complete order dataset.pingsample— Send a sample of the order dataset.
3. Check the Requested Entity
Retrieve the entity currently being requested:
GET https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/entity
The response should identify the requested entity:
{
"entity": "orders"
}
or:
{
"entity": "products"
}
For this operation, the daemon should continue with the order upload flow only when the returned entity is orders.
4. Retrieve the Cursor Offset
Retrieve the current cursor position:
GET https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/cursoroffset
A response should have a structure similar to:
{
"cursoroffset": 1517358864869
}
The cursoroffset represents the last update timestamp, in milliseconds, of the last record discovered by Talk2Sync for the currently selected entity type.
This value can be used by the external system to determine which records should be considered during synchronization.
5. Initialize the Upstream Process
After obtaining the required connection information, initialize the upstream process:
POST https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/push/initialize
The endpoint should return HTTP status 200.
After initialization, querying the upstream status again should return:
{
"connectionstatus": "initialized"
}
The daemon should proceed only after the upstream process has been successfully initialized.
6. Select the Order Push Operation
If the requested entity is orders, the daemon can begin sending order data.
The endpoint depends on the synchronization strategy.
Sample Push
When the strategy is pingsample, send a sample for health-check purposes:
POST https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/pingsample/orders
Full Order Push
When the strategy is push, send the order dataset:
POST https://api.talk2sync.com/api/adapters/custom/reverse/connection/{{your key}}/push/orders
7. Order Payload
The request body should contain an orders array with the orders being sent to Talk2Sync:
{
"orders": [
{
"_id": "75554554546",
"orderid": "777777",
"last_updated": 1517360038797,
"status": "paid",
"dateCreated": "",
"dateClosed": "",
"total": {
"amount": 350,
"currency": "USD"
},
"orderItems": [
{
"id": "7778545",
"variation_id": "0",
"quantity": "1",
"unitPrice": "350",
"currencyId": "USD"
}
],
"buyer": {
"id": "4578889",
"email": "testbuyer@example.com",
"phone": "88888888",
"firstName": "John",
"lastName": "Doe"
}
}
]
}
Process Summary
The complete operation follows this sequence:
Next Steps
- Review Set Finish Order Pushes to finalize the order upload operation.
- Review Push Products Page for the corresponding product upload process.
- Review the Order Upload Protocol to understand where this operation fits into the complete reverse connection flow.