pixiGetChangedOrders
Returns the header data of all orders that were created or changed, including changes to their order lines or addresses, since a given point in time.
Use this call for delta synchronisation of orders. It returns one row per changed order.
Time window
- The end of the window,
DateTimeTo, is the server time at execution (GETDATE()). It is returned in every row. - If
DateTimeFromis later than five minutes before the server time, it is moved back to now minus 5 minutes. Every call therefore covers at least the last five minutes.
Which orders count as changed
An order is selected if at least one of the following timestamps is at or after DateTimeFrom and not after DateTimeTo:
- The order header:
UpdateDate, orCreateDateif the order was never updated. - An order line: its
UpdateDate, orCreateDatefor lines that were never updated. - The billing address (
AddrRef) or the shipping address (ShipAdrRef) of the order:UpdateDate, orCreateDateif never updated.
Direct fulfillment filter
ReturnOnlyDFOrders = 0(default): all changed orders are returned.ReturnOnlyDFOrders = 1: only changed orders that have at least one order line with anOrderHistoryentry with statusFUTare returned.
Returned data
- Header fields come from the order header, the customer (
ShopIDis the customer'sCustomerOf) and the addresses.PaymentTypeis the payment type of the billing address.OrderLockedis the lock flag of the shipping address (Nif empty). - Aggregated order line fields per order:
OrderDate, which is the latest order line date or the earliest one if the settingUseInitialOrderDateis1; the highestVoucherIDwith itsVoucherAmount; the currency codeOrderCurrency; the latestEstimatedDelivery. - Only orders with an existing customer, billing address and shipping address are returned. The rows are not sorted.
Notes
- Polling: Pass the
DateTimeTovalue of the previous response asDateTimeFromof the next call. Because of the minimum window of five minutes, the same order can be returned in consecutive calls. Process the rows idempotently. - If
DateTimeFromisNULL, no order matches and the result is empty. - Unused parameter:
skipGetXMLValueis declared but not used by the code. - Dirty reads: All permanent tables are read with
NOLOCK. Uncommitted data can appear, and rows can be missed or duplicated during concurrent changes. - Setting:
UseInitialOrderDateis read from theSettingstable and controls whetherOrderDateis the earliest or the latest order line date. - Missing currency: The order line aggregates (
OrderDate,VoucherID,VoucherAmount,OrderCurrency,EstimatedDelivery) areNULLif the order's currency is not found inpixi.Currencyor the order has no lines. - EstimatedDelivery: The code compares it with a placeholder date (now + 999 days, including the time of day). In practice this almost never matches, so the value is returned unchanged.
- Performance: The call scans addresses, order headers and order lines by date. Very old
DateTimeFromvalues can produce large results and long run times.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
DateTimeFrom
Required
|
datetime dateTime |
– |
Start of the change window. Values later than five minutes before the server time are moved back to now minus 5 minutes. Example: |
skipGetXMLValue
|
bit boolean |
1 |
Not used by the code. It has no effect. Example: |
ReturnOnlyDFOrders
|
bit boolean |
0 |
Restricts the result to direct fulfillment orders, meaning orders with an order line that has an Allowed values
Example: |
Result set 1 · Always; empty if no order changed in the window.
One row per changed order with header, customer, address and aggregated order line data.
| Column | Type | Description |
|---|---|---|
DateTimeTo
|
datetime dateTime |
Server time at execution. Use it as |
OrderHeaderKey
Nullable |
int |
Internal key of the order header. |
OrderNr
Nullable |
int |
Pixi order number. |
CreateDate
Nullable |
datetime dateTime |
Creation date of the order header. |
OrderNrExternal
Nullable |
varchar(50) string |
External (shop) order number. |
WholeOrderState
Nullable |
varchar(10) string |
Status of the whole order ( |
ShipVendorCode
Nullable |
varchar(3) string |
Code of the shipping vendor. |
ShopID
Nullable |
varchar(3) string |
Shop of the customer ( |
ShipCost
Nullable |
money decimal |
Shipping cost of the order. |
PaymentAddressId
Nullable |
int |
Key of the billing address. |
ShipmentAddressId
Nullable |
int |
Key of the shipping address. |
DeliveryDate
Nullable |
datetime dateTime |
Ship date of the order header ( |
Referrer
Nullable |
varchar(50) string |
Referrer of the order. |
GiftMessage
Nullable |
varchar(8000) string |
Gift message. |
AddressRemarks
Nullable |
varchar(255) string |
Address remarks of the order. |
ShopNote
Nullable |
varchar(max) string |
Note from the shop. |
PaymentType
Nullable |
varchar(1) string |
Payment type of the billing address ( |
CustKey
Nullable |
int |
Internal customer key. |
CustomerEmail
Nullable |
varchar(256) string |
E-mail address of the customer. |
CustomerNrExternal
Nullable |
varchar(60) string |
External customer number. |
OrderLocked
|
varchar(1) string |
Lock flag of the shipping address ( |
OrderDate
Nullable |
datetime dateTime |
Latest order line date, or the earliest one if the setting |
VoucherID
Nullable |
varchar(50) string |
Highest voucher ID found on the order lines. |
VoucherAmount
Nullable |
money decimal |
Amount of that voucher from the voucher table. |
OrderCurrency
Nullable |
varchar(3) string |
Currency code of the order ( |
EstimatedDelivery
Nullable |
datetime dateTime |
Latest estimated delivery date of the order lines. |
Response example
<SqlRowSet1>
<row>
<DateTimeTo>2024-05-14T10:15:32.457</DateTimeTo>
<OrderHeaderKey>48211</OrderHeaderKey>
<OrderNr>100482</OrderNr>
<CreateDate>2024-05-14T09:58:10.123</CreateDate>
<OrderNrExternal>SHOP-2024-77812</OrderNrExternal>
<WholeOrderState>AUF</WholeOrderState>
<ShipVendorCode>DHL</ShipVendorCode>
<ShopID>WEB</ShopID>
<ShipCost>4.9500</ShipCost>
<PaymentAddressId>90311</PaymentAddressId>
<ShipmentAddressId>90312</ShipmentAddressId>
<Referrer>google</Referrer>
<PaymentType>V</PaymentType>
<CustKey>55120</CustKey>
<CustomerEmail>max.mustermann@example.com</CustomerEmail>
<CustomerNrExternal>K-10077</CustomerNrExternal>
<OrderLocked>N</OrderLocked>
<OrderDate>2024-05-14T09:57:44</OrderDate>
<OrderCurrency>EUR</OrderCurrency>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetChangedOrders>
<DateTimeFrom>2024-05-14T08:00:00</DateTimeFrom>
<!-- <skipGetXMLValue>1</skipGetXMLValue> -->
<!-- <ReturnOnlyDFOrders>0</ReturnOnlyDFOrders> -->
</ns1:pixiGetChangedOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetChangedOrders>
<DateTimeFrom>2024-05-14T08:00:00</DateTimeFrom>
<!-- <skipGetXMLValue>1</skipGetXMLValue> -->
<!-- <ReturnOnlyDFOrders>0</ReturnOnlyDFOrders> -->
</ns1:pixiGetChangedOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
'DateTimeFrom' => '2024-05-14T08:00:00',
// 'skipGetXMLValue' => '1',
// 'ReturnOnlyDFOrders' => '0',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetChangedOrders', $soapArguments);
- SQL object:
- dbo.pipiGetChangedOrders