pixiEmillGetCustomers
Returns customers with email address and name, optionally filtered by order or ship date, item, payment and shipping status or shop, with key-based paging.
Returns a list of customers (key, email, first name, last name, shop) for use in email marketing tools. The procedure builds a dynamic query on Customers joined to Addresses (inner join on the customer's address reference). All filters are optional and combined with AND:
orderdate: only customers with at least one order line whose order date falls on the same calendar day (year, month and day are compared; the time is ignored).ShipDate: only customers with at least one order line shipped on that calendar day.EanUpc: only customers who ordered an item with this EAN/UPC.ArticleNr: only customers who ordered an item whose supplier item number (ItemNrSuppl) matches.paid:1= customers with at least one invoice where the paid sum equals the total;0= customers with at least one invoice where the paid sum differs from the total.Shipped:1= customers with at least one shipped order line;0= customers with at least one order line without ship date.ShopID: only customers belonging to this shop (CustomerOf). An empty string is treated as no filter.
The result is sorted by customer key ascending and limited to Top rows. For paging, pass the highest custkey of the previous page as resumeKey; only customers with a larger key are returned.
Notes
- All reads use
NOLOCK, so results can contain uncommitted data. - The row limit is applied with
SET ROWCOUNT;Top=0returns all matching rows. - Customers without a matching address record are not returned because of the inner join.
- The
paidandShippedfilters test for at least one matching invoice or order line, not for all of them.paid = 1therefore also returns customers who additionally have unpaid invoices. - Date filters use
DATEPARTon the column, so indexes on order or ship date cannot be used; on large databases these filters can be slow. ArticleNris compared with the supplier item number (ItemNrSuppl), not with the internal item number.- The statement is passed to
sp_executesqlunder the parameter name@statmentinstead of the documented@stmt; the call relies on positional handling of this parameter.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
orderdate
|
datetime dateTime |
NULL |
Only customers with an order line ordered on this calendar day. Time part is ignored. Example: |
ShipDate
|
datetime dateTime |
NULL |
Only customers with an order line shipped on this calendar day. Time part is ignored. Example: |
EanUpc
|
varchar(13) string |
NULL |
Only customers who ordered an item with this EAN/UPC. Example: |
ArticleNr
|
varchar(50) string |
NULL |
Only customers who ordered an item with this supplier item number ( Example: |
paid
|
bit boolean |
NULL |
Filter on invoice payment status. Allowed values
Example: |
Shipped
|
bit boolean |
NULL |
Filter on shipping status of order lines. Allowed values
Example: |
resumeKey
|
int | NULL |
Paging key: only customers with a customer key greater than this value are returned. Pass the last Example: |
Top
|
int | 100 |
Maximum number of rows returned (applied via Example: |
ShopID
|
varchar(3) string |
NULL |
Only customers of this shop ( Example: |
Result set 1 · Always
Matching customers, sorted by customer key ascending, limited to Top rows.
| Column | Type | Description |
|---|---|---|
custkey
|
int |
Internal customer key; use the highest value as |
cemail
Nullable |
string |
Email address of the customer. |
firstname
Nullable |
string |
First name from the customer's address. |
lastname
Nullable |
string |
Last name from the customer's address. |
ShopID
Nullable |
string |
Shop the customer belongs to ( |
Response example
<SqlRowSet1>
<row>
<custkey>10251</custkey>
<cemail>anna.schmidt@example.de</cemail>
<firstname>Anna</firstname>
<lastname>Schmidt</lastname>
<ShopID>SH1</ShopID>
</row>
<row>
<custkey>10254</custkey>
<cemail>m.weber@example.com</cemail>
<firstname>Markus</firstname>
<lastname>Weber</lastname>
<ShopID>SH1</ShopID>
</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:pixiEmillGetCustomers>
<!-- <orderdate>2024-03-15T00:00:00</orderdate> -->
<!-- <ShipDate>2024-03-18T00:00:00</ShipDate> -->
<!-- <EanUpc>4006381333931</EanUpc> -->
<!-- <ArticleNr>BK-1002-BLK</ArticleNr> -->
<!-- <paid>0</paid> -->
<!-- <Shipped>1</Shipped> -->
<!-- <resumeKey>10250</resumeKey> -->
<!-- <Top>500</Top> -->
<!-- <ShopID>SH1</ShopID> -->
</ns1:pixiEmillGetCustomers>
</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:pixiEmillGetCustomers>
<!-- <orderdate>2024-03-15T00:00:00</orderdate> -->
<!-- <ShipDate>2024-03-18T00:00:00</ShipDate> -->
<!-- <EanUpc>4006381333931</EanUpc> -->
<!-- <ArticleNr>BK-1002-BLK</ArticleNr> -->
<!-- <paid>0</paid> -->
<!-- <Shipped>1</Shipped> -->
<!-- <resumeKey>10250</resumeKey> -->
<!-- <Top>500</Top> -->
<!-- <ShopID>SH1</ShopID> -->
</ns1:pixiEmillGetCustomers>
</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 = [
// 'orderdate' => '2024-03-15T00:00:00',
// 'ShipDate' => '2024-03-18T00:00:00',
// 'EanUpc' => '4006381333931',
// 'ArticleNr' => 'BK-1002-BLK',
// 'paid' => '0',
// 'Shipped' => '1',
// 'resumeKey' => '10250',
// 'Top' => '500',
// 'ShopID' => 'SH1',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiEmillGetCustomers', $soapArguments);
- SQL object:
- dbo.pipiEmillGetCustomers