pixiCustomerKeyByNumber
Returns the internal customer key (CustKey) for an external customer number within a given shop.
Looks up a customer in the Customers table by the external customer number (CustomerNrExternal) and the shop the customer belongs to (CustomerOf = ShopId).
- If
AllowAmbiguous= 1, the key of one matching customer is returned, even if several customers share the same external number in that shop. - If
AllowAmbiguous= 0, a key is returned only if exactly one customer matches. If there are several matches, the result set is empty. - If no customer matches, the result set is empty.
At most one row is returned.
Notes
- All parameters are required; none has a default value.
- The query uses
TOP 1withoutORDER BY. WhenAllowAmbiguous= 1 and several customers match, it is not defined whichCustKeyis returned. - Reads use
NOLOCK, so uncommitted data may be seen. - An empty result means either no match or, with
AllowAmbiguous= 0, an ambiguous match. The caller cannot tell which case applies.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
CustomerNrExternal
Required
|
varchar(60) string |
– |
External customer number, e.g. the customer number in the online shop. Example: |
ShopId
Required
|
char(3) string |
– |
Shop ID the customer belongs to. It is compared with Example: |
AllowAmbiguous
Required
|
bit boolean |
– |
Controls whether a key is returned when several customers match. Allowed values
Example: |
Result set 1 · Always. Contains one row if a matching customer is found and the ambiguity rule is met, otherwise no row.
Internal key of the found customer.
| Column | Type | Description |
|---|---|---|
CustKey
|
int |
Internal customer key from |
Response example
<SqlRowSet1>
<row>
<CustKey>48213</CustKey>
</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:pixiCustomerKeyByNumber>
<CustomerNrExternal>WEB-100245</CustomerNrExternal>
<ShopId>SHP</ShopId>
<AllowAmbiguous>0</AllowAmbiguous>
</ns1:pixiCustomerKeyByNumber>
</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:pixiCustomerKeyByNumber>
<CustomerNrExternal>WEB-100245</CustomerNrExternal>
<ShopId>SHP</ShopId>
<AllowAmbiguous>0</AllowAmbiguous>
</ns1:pixiCustomerKeyByNumber>
</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 = [
'CustomerNrExternal' => 'WEB-100245',
'ShopId' => 'SHP',
'AllowAmbiguous' => '0',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCustomerKeyByNumber', $soapArguments);
- SQL object:
- dbo.pipiCustomerKeyByNumber