pixiCreateSupplier
Creates a new supplier together with its main contact and returns a status row with ReturnCode and Message.
Creates one new supplier record in Suppliers and one main contact record in pixi.Contact, linked via ContactId.
Steps:
- Every string parameter passed as an empty string is treated as
NULL.SupplCtryis trimmed first. - If
CurrencyIdis not passed, the database currency is used. This is the currency from theHomeCurrencysetting, read viapixi.GetDatabaseCurrency. CanDoDirectFulfillmentis converted to a bit:Ybecomes 1.Nand any other value become 0.- Validation runs in this order and stops at the first error:
SupplNrmust be given.SupplNamemust be given.CanDoDirectFulfillmentmust not beNULL.- No supplier with the same
SupplNrmay already exist.
- If all checks pass, a contact row is inserted. Contact fields that are not passed are stored as empty strings. The supplier is then inserted with:
ContactIdset to the new contact's identityCreateDateset to the current timeCreateEmpset toAPIMailBoxset toeMailSupplCommentset toSupplierComment
The call always returns exactly one status row. ReturnCode is OK on success and Error on a validation error or an unexpected SQL error.
Notes
- Everything runs in the named transaction
CreateSupplier. On an SQL error the transaction is rolled back andErrorMessagecontains the SQL error text. Validation errors are not SQL errors: the transaction is committed, but nothing has been written. - The duplicate check on
SupplNrusesNOLOCK. Two parallel calls with the same number can therefore both pass the check. In that case a unique constraint on the table, if one exists, would produce the generic error. RowsAffectedis never updated and is always0.DefaultDeliveryDaysis compared to an empty string. As anint, the value0is therefore stored asNULL.- An empty string for
CanDoDirectFulfillmentpasses the mandatory check and is stored as 0. SupplGroup,SupplCtryandCurrencyIdare not validated against master data.- If no database currency can be determined,
CurrencyIdstaysNULL. - A contact row is always created, even if no
MainContact_*parameter is passed. - Values longer than the declared parameter length (e.g.
SupplNrwith more than 4 characters) may be truncated silently.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
SupplNr
|
varchar(4) string |
NULL |
Supplier number (key). Functionally mandatory; must not exist yet. Example: |
SupplName
|
varchar(60) string |
NULL |
Supplier name. Functionally mandatory. Example: |
SupplNameExt
|
varchar(50) string |
NULL |
Name extension. Example: |
SupplGroup
|
varchar(4) string |
NULL |
Supplier group code (not validated). Example: |
DefaultDeliveryDays
|
int | NULL |
Default delivery time in days. The value 0 is stored as NULL. Example: |
SupplFaxNR
|
varchar(100) string |
NULL |
Supplier fax number. Example: |
CustNR
|
varchar(20) string |
NULL |
Own customer number at the supplier. Example: |
eMail
|
varchar(60) string |
NULL |
General e-mail address; stored in column Example: |
SupAnrede
|
varchar(20) string |
NULL |
Salutation of the supplier address. Example: |
SupName2
|
varchar(60) string |
NULL |
Second name line of the address. Example: |
SupAddress
|
varchar(50) string |
NULL |
Street and house number. Example: |
SupZip
|
varchar(20) string |
NULL |
Postal code. Example: |
SupPhone1
|
varchar(50) string |
NULL |
First phone number. Example: |
CanDoDirectFulfillment
|
varchar(1) string |
NULL |
Whether the supplier can do direct fulfillment (drop shipping). Functionally mandatory (must not be NULL). Allowed values
Example: |
SupCity
|
varchar(50) string |
NULL |
City. Example: |
SupPhone2
|
varchar(50) string |
NULL |
Second phone number. Example: |
SupplCtry
|
varchar(3) string |
NULL |
Country code; trimmed, not validated. Example: |
CurrencyId
|
smallint int |
NULL |
Currency ID of the supplier. If not passed, the database currency (setting Example: |
eMailSupplOrder
|
varchar(255) string |
NULL |
E-mail address for supplier orders. Example: |
HomePageUrl
|
nvarchar(2000) string |
NULL |
Website of the supplier. Example: |
MainContact_Title
|
nvarchar(100) string |
NULL |
Title of the main contact. Example: |
MainContact_FirstName
|
nvarchar(20) string |
NULL |
First name of the main contact. Example: |
MainContact_LastName
|
nvarchar(200) string |
NULL |
Last name of the main contact. Example: |
MainContact_JobTitle
|
nvarchar(200) string |
NULL |
Job title of the main contact. Example: |
MainContact_JobFunction
|
nvarchar(200) string |
NULL |
Job function of the main contact. Example: |
MainContact_Phone
|
varchar(200) string |
NULL |
Phone number of the main contact. Example: |
MainContact_MobilePhone
|
varchar(200) string |
NULL |
Mobile phone number of the main contact. Example: |
MainContact_Fax
|
nvarchar(200) string |
NULL |
Fax number of the main contact. Example: |
MainContact_Email
|
nvarchar(200) string |
NULL |
E-mail address of the main contact. Example: |
SupplierComment
|
varchar(8000) string |
NULL |
Comment on the supplier; stored in Example: |
Result set 1 · Always (exactly one row: success, validation error or SQL error)
Status row of the call.
| Column | Type | Description |
|---|---|---|
RowsAffected
|
int |
Always 0 (never updated). |
ReturnCode
Nullable |
varchar(100) string |
|
Message
Nullable |
varchar(4000) string |
Success or error message. |
ErrorMessage
Nullable |
nvarchar(4000) string |
SQL error text in case of an unexpected error, otherwise an empty string. |
Response example
<SqlRowSet1>
<row>
<RowsAffected>0</RowsAffected>
<ReturnCode>OK</ReturnCode>
<Message>Supplier with SupplNr: "L042" successfully created.</Message>
<ErrorMessage/>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | SupplNr is a mandatory parameter that needs to be provided. | `SupplNr` was not passed or is empty. |
| Error | SupplName is a mandatory parameter that needs to be provided. | `SupplName` was not passed or is empty. |
| Error | CanDoDirectFulfillment is a mandatory parameter that needs to be provided. | `CanDoDirectFulfillment` was not passed (NULL). Pass `Y` or `N`. |
| Error | Supplier with SupplNr: "{SupplNr}" already exists. | A supplier with this number already exists in `Suppliers`. Use a different number. |
| Error | Something went wrong. Please conntact pixi* support. | An unexpected SQL error occurred during the inserts (e.g. constraint violation). The transaction is rolled back; details are in `ErrorMessage`. |
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:pixiCreateSupplier>
<!-- <SupplNr>L042</SupplNr> -->
<!-- <SupplName>Muster Handels GmbH</SupplName> -->
<!-- <SupplNameExt>Großhandel</SupplNameExt> -->
<!-- <SupplGroup>STD</SupplGroup> -->
<!-- <DefaultDeliveryDays>3</DefaultDeliveryDays> -->
<!-- <SupplFaxNR>+49 89 1234567-99</SupplFaxNR> -->
<!-- <CustNR>K-778812</CustNR> -->
<!-- <eMail>info@muster-handel.de</eMail> -->
<!-- <SupAnrede>Firma</SupAnrede> -->
<!-- <SupName2>Abteilung Einkauf</SupName2> -->
<!-- <SupAddress>Industriestraße 12</SupAddress> -->
<!-- <SupZip>80331</SupZip> -->
<!-- <SupPhone1>+49 89 1234567-0</SupPhone1> -->
<!-- <CanDoDirectFulfillment>N</CanDoDirectFulfillment> -->
<!-- <SupCity>München</SupCity> -->
<!-- <SupPhone2>+49 89 1234567-10</SupPhone2> -->
<!-- <SupplCtry>DE</SupplCtry> -->
<!-- <CurrencyId>1</CurrencyId> -->
<!-- <eMailSupplOrder>bestellung@muster-handel.de</eMailSupplOrder> -->
<!-- <HomePageUrl>https://www.muster-handel.de</HomePageUrl> -->
<!-- <MainContact_Title>Herr</MainContact_Title> -->
<!-- <MainContact_FirstName>Thomas</MainContact_FirstName> -->
<!-- <MainContact_LastName>Becker</MainContact_LastName> -->
<!-- <MainContact_JobTitle>Vertriebsleiter</MainContact_JobTitle> -->
<!-- <MainContact_JobFunction>Key Account</MainContact_JobFunction> -->
<!-- <MainContact_Phone>+49 89 1234567-21</MainContact_Phone> -->
<!-- <MainContact_MobilePhone>+49 171 2345678</MainContact_MobilePhone> -->
<!-- <MainContact_Fax>+49 89 1234567-99</MainContact_Fax> -->
<!-- <MainContact_Email>t.becker@muster-handel.de</MainContact_Email> -->
<!-- <SupplierComment>Mindestbestellwert 250 EUR</SupplierComment> -->
</ns1:pixiCreateSupplier>
</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:pixiCreateSupplier>
<!-- <SupplNr>L042</SupplNr> -->
<!-- <SupplName>Muster Handels GmbH</SupplName> -->
<!-- <SupplNameExt>Großhandel</SupplNameExt> -->
<!-- <SupplGroup>STD</SupplGroup> -->
<!-- <DefaultDeliveryDays>3</DefaultDeliveryDays> -->
<!-- <SupplFaxNR>+49 89 1234567-99</SupplFaxNR> -->
<!-- <CustNR>K-778812</CustNR> -->
<!-- <eMail>info@muster-handel.de</eMail> -->
<!-- <SupAnrede>Firma</SupAnrede> -->
<!-- <SupName2>Abteilung Einkauf</SupName2> -->
<!-- <SupAddress>Industriestraße 12</SupAddress> -->
<!-- <SupZip>80331</SupZip> -->
<!-- <SupPhone1>+49 89 1234567-0</SupPhone1> -->
<!-- <CanDoDirectFulfillment>N</CanDoDirectFulfillment> -->
<!-- <SupCity>München</SupCity> -->
<!-- <SupPhone2>+49 89 1234567-10</SupPhone2> -->
<!-- <SupplCtry>DE</SupplCtry> -->
<!-- <CurrencyId>1</CurrencyId> -->
<!-- <eMailSupplOrder>bestellung@muster-handel.de</eMailSupplOrder> -->
<!-- <HomePageUrl>https://www.muster-handel.de</HomePageUrl> -->
<!-- <MainContact_Title>Herr</MainContact_Title> -->
<!-- <MainContact_FirstName>Thomas</MainContact_FirstName> -->
<!-- <MainContact_LastName>Becker</MainContact_LastName> -->
<!-- <MainContact_JobTitle>Vertriebsleiter</MainContact_JobTitle> -->
<!-- <MainContact_JobFunction>Key Account</MainContact_JobFunction> -->
<!-- <MainContact_Phone>+49 89 1234567-21</MainContact_Phone> -->
<!-- <MainContact_MobilePhone>+49 171 2345678</MainContact_MobilePhone> -->
<!-- <MainContact_Fax>+49 89 1234567-99</MainContact_Fax> -->
<!-- <MainContact_Email>t.becker@muster-handel.de</MainContact_Email> -->
<!-- <SupplierComment>Mindestbestellwert 250 EUR</SupplierComment> -->
</ns1:pixiCreateSupplier>
</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 = [
// 'SupplNr' => 'L042',
// 'SupplName' => 'Muster Handels GmbH',
// 'SupplNameExt' => 'Großhandel',
// 'SupplGroup' => 'STD',
// 'DefaultDeliveryDays' => '3',
// 'SupplFaxNR' => '+49 89 1234567-99',
// 'CustNR' => 'K-778812',
// 'eMail' => 'info@muster-handel.de',
// 'SupAnrede' => 'Firma',
// 'SupName2' => 'Abteilung Einkauf',
// 'SupAddress' => 'Industriestraße 12',
// 'SupZip' => '80331',
// 'SupPhone1' => '+49 89 1234567-0',
// 'CanDoDirectFulfillment' => 'N',
// 'SupCity' => 'München',
// 'SupPhone2' => '+49 89 1234567-10',
// 'SupplCtry' => 'DE',
// 'CurrencyId' => '1',
// 'eMailSupplOrder' => 'bestellung@muster-handel.de',
// 'HomePageUrl' => 'https://www.muster-handel.de',
// 'MainContact_Title' => 'Herr',
// 'MainContact_FirstName' => 'Thomas',
// 'MainContact_LastName' => 'Becker',
// 'MainContact_JobTitle' => 'Vertriebsleiter',
// 'MainContact_JobFunction' => 'Key Account',
// 'MainContact_Phone' => '+49 89 1234567-21',
// 'MainContact_MobilePhone' => '+49 171 2345678',
// 'MainContact_Fax' => '+49 89 1234567-99',
// 'MainContact_Email' => 't.becker@muster-handel.de',
// 'SupplierComment' => 'Mindestbestellwert 250 EUR',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCreateSupplier', $soapArguments);
- SQL object:
- dbo.pipiCreateSupplier