Polling pattern implementation guide
The polling API offers an alternative to the webhook API for retrieving order or shipment updates. Both approaches have different advantages and considerations:
Overview
Section titled “Overview”The polling pattern consists of three essential steps:
- Fetch - Retrieve orders or shipments changed since the last poll.
- Process - Handle the retrieved new or updated data.
- Persist - Store the latest timestamp for the next polling cycle.
Implementation steps
Section titled “Implementation steps”Step 1: Fetch updated data periodically
Section titled “Step 1: Fetch updated data periodically”Set up a scheduled process to fetch all orders or shipments that have been created or changed since your last poll.
Polling best practices
Section titled “Polling best practices”- Use a consistent polling interval (typically 5 minutes)
- Include the
lastUpdatedAttimestamp from previous poll response as thelastUpdatedAfterfilter.- Do not use the system clock time for
lastUpdatedAfter– clock skew or availability issues can cause you to miss updates.
- Do not use the system clock time for
- Set
limit=100(the maximum allowed value) to control response size. - Handle pagination when needed:
- If response contains
total> 100, not all updates were returned. - Either decrease the polling period (recommended) or use the
offsetparameter for paging.
- If response contains
Available endpoints
Section titled “Available endpoints”| Data Type | Endpoint | Use Case |
|---|---|---|
| Orders (delivery schedule) | Poll orders | For orders using delivery schedule feature |
| Orders (single delivery) | Poll single delivery orders | For orders using single delivery per line |
| Shipments | Poll shipments | For shipment updates |
Example request
Section titled “Example request”GET /v2/order-search/poll
{ "filters": { "lastUpdatedAfter": "2025-04-23T10:01:53.812Z" }, "limit": 100}Buyer: filter on Confirmed orders
Section titled “Buyer: filter on Confirmed orders”Optionally, the buyer can filter on Confirmed orders and ignore orders with other statuses.
GET /v2/order-search/poll
{ "filters": { "status": { "processStatus": ["Confirmed"] }, "lastUpdatedAfter": "2025-04-23T10:01:53.812Z" }, "limit": 100}- The
Confirmedprocess status is set at order level only when every order line has been confirmed by the supplier. - An order with even one unconfirmed line will not appear in these results yet.
- Individual order lines can still have a different status (for example,
CancelledorCompleted). Your integration must filter client-side: only process lines wheredata.lines.status.processStatusequalsConfirmed.
Buyer: receive confirmed lines as soon as possible
Section titled “Buyer: receive confirmed lines as soon as possible”To process confirmed order lines without waiting for the entire order to reach Confirmed, filter on both Confirmed and InProgress:
GET /v2/order-search/poll
{ "filters": { "status": { "processStatus": ["Confirmed", "InProgress"] }, "lastUpdatedAfter": "2025-04-23T10:01:53.812Z" }, "limit": 100}- An order moves to
InProgressas soon as the supplier confirms the first line, before all lines are confirmed. - Confirmed lines therefore become available in your poll results earlier, you do not have to wait for the full order to be confirmed.
- These orders will also contain lines that are not yet confirmed. Your integration must filter client-side: only process lines where
data.lines.status.processStatusequalsConfirmed.
Suppliers: filter on Issued orders
Section titled “Suppliers: filter on Issued orders”Optionally, the supplier can filter on Issued orders and ignore orders with other statuses.
GET /v2/order-search/poll
{ "filters": { "status": { "processStatus": ["Issued"] }, "lastUpdatedAfter": "2025-04-23T10:01:53.812Z" }, "limit": 100}- The supplier may still receive Issued orders that have been updated by the buyer.
- If you are a supplier, check if the purchase order already exists in your ERP system and either ignore the update or update the existing order.
Step 2: Process retrieved data
Section titled “Step 2: Process retrieved data”Implement logic to handle the fetched new or updated orders or shipments.
Example response
Section titled “Example response”{ "data": [ { "supplierAccountNumber": "SUPPLIER12345", "purchaseOrderNumber": "PO123456789", "lines": [ { "deliverySchedule" ... "prices" ... "status": { "processStatus": "Issued", "logisticsStatus": "Open" }, "lastUpdatedAt": "2025-04-23T10:01:53.812Z" } ], "status": { "processStatus": "Issued", "logisticsStatus": "Open" }, "lastUpdatedAt": "2025-04-23T10:01:53.812Z" } ], "total": 10, "lastUpdatedAt": "2025-04-23T10:01:53.812Z"}Order processing tips
Section titled “Order processing tips”When working with order endpoints:
- The supplier must check whether the purchase order already exists in their ERP system and either ignore the update or update the existing order.
- Use
data.lines.lastUpdatedAtto identify which specific lines have changed since thelastUpdatedAftertime you provided. - Filter by order- and line-level status using
data.statusanddata.lines.statusfields. See Order and line status for the complete list of values:processStatusinProgressStatuslogisticsStatusdeliveryLineStatus
Shipment processing tips
Section titled “Shipment processing tips”When working with the shipment endpoint:
- Use
data.lines.meta.lastUpdatedAtto identify changed shipment lines since thelastUpdatedAftertime you provided. - Filter by
data.statusto focus on relevant shipment statuses
Step 3: Persist the timestamp
Section titled “Step 3: Persist the timestamp”Store the lastUpdatedAt value to use as lastUpdatedAfter in subsequent requests.
When the poll response is empty, keep using the same timestamp until you get results.
Implementation tips
Section titled “Implementation tips”- The timestamp has format
YYYY-MM-DDThh:mm:ss.SSSZ(ISO 8601). Persist the full timestamp, including theZtimezone indicator, and send it back with the next polling request. - Persist the complete timestamp string to prevent timezone conversion issues.
- Store it in durable storage (database or file system).
- Your storage solution must survive application restarts or crashes.
- If the response contains no data, reuse the current
lastUpdatedAftervalue. - For first-time polling, use a well-chosen historical date to retrieve or skip existing orders.
