pixiSetItemStatus
Enables or disables an item, or activates or deactivates its supplier assignment, and queues the item for export to the shop.
Sets the status of an item.
- Find the item. The item is searched in
ItemsbyItemKey(only ifItemKeyis passed) or byItemNrInt. If no item matches, status404is returned. If more than one item matches, status409is returned. This can also happen when bothItemKeyandItemNrIntare passed and they point to different items. - Update the status.
- Without
SupplierID(or with an empty string): theEnabledflag of the item inItemsis set to the value ofEnabled. - With
SupplierID: the item's supplier record inAddItems(matched by item andSupplNr=SupplierID) is searched. If none or more than one is found, status404or409is returned. If exactly one is found, itsActiveflag is set toEnabled. In this case the item's ownEnabledflag is not changed. - If the update fails, status
500with the SQL error message is returned.
- Without
- On success the item is queued for recalculation and forced export to the shop. Then the item is returned with
ItemKey,ItemNrInt,Enabled, the passedSupplNrand, if a supplier was passed, the supplier record'sActiveflag.
In case of an error, a single row with Status and ErrorMsg is returned instead.
Notes
- Empty error message: if
ItemKeyis not passed and the item is not found, the404message evaluates to NULL. The reason is that the message concatenatesItemKeywithout NULL handling, soErrorMsgmay be empty. Rely onStatus. - Empty result on success: the success result joins
ItemswithAddItems. An item without any supplier record (AddItems) therefore returns no rows, even though the update succeeded. - Side effect on success:
Pixi_ExportItemChangesToShopinserts the item intopixi.ItemRecalculateStockQueuewithForceToExport = 1. No export is queued when an error occurs. - Transactions and locking: no explicit transaction is used. Reads use
NOLOCKand updates useROWLOCK. - Temporary tables: they are dropped via
util.TempTableDrop, whose definition is not attached.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemNrInt
|
varchar(50) string |
NULL |
Internal item number. Used to find the item if Example: |
ItemKey
|
int | NULL |
Internal key of the item. Alternative to Example: |
Enabled
|
bit boolean |
1 |
New status. It is written to Allowed values
Example: |
SupplierID
|
varchar(4) string |
NULL |
Supplier number ( Example: |
Result set 1 · On success (status 200); may be empty if the item has no AddItems record
The updated item. Without SupplierID, one distinct row is returned with SupplNr and Active set to NULL.
| Column | Type | Description |
|---|---|---|
ItemKey
|
int |
Internal key of the item |
ItemNrInt
Nullable |
varchar(50) string |
Internal item number |
Enabled
Nullable |
bit boolean |
Current enabled flag of the item |
SupplNr
Nullable |
varchar(4) string |
The passed supplier number, or NULL |
Active
Nullable |
bit boolean |
Active flag of the supplier record. NULL if no supplier was passed. |
Result set 2 · On error (status 404, 409 or 500)
Status row describing the error.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(3) string |
Error code: |
ErrorMsg
Nullable |
varchar(2000) string |
Error message; may be NULL (see notes) |
Response example
<SqlRowSet1>
<row>
<ItemKey>4711</ItemKey>
<ItemNrInt>A-10045</ItemNrInt>
<Enabled>1</Enabled>
<SupplNr>LIE1</SupplNr>
<Active>0</Active>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| 404 | Item with ItemNrInt/ItemKey: {ItemNrInt}/{ItemKey} was not found. | No item matches `ItemKey` or `ItemNrInt`. If `ItemKey` was not passed, the message is NULL. |
| 409 | Item with ItemNrInt: {ItemNrInt} could not be uniquely identified. {RowCount} items found. | Several items match. This happens, for example, when `ItemKey` and `ItemNrInt` refer to different items. Pass only one identifier. |
| 404 | Item with ItemNrInt/ItemKey: {ItemNrInt}/{ItemKey} and SupplierID: "{SupplierID}" was not found. | The item has no `AddItems` record for the given supplier. |
| 409 | Item with ItemNrInt/ItemKey: {ItemNrInt}/{ItemKey} and SupplierID: "{SupplierID}" could not be uniquely identified. {RowCount} items found. | The item has more than one `AddItems` record for the given supplier. |
| 500 | {ERROR_MESSAGE()} | The update of `Items` or `AddItems` failed; the SQL error text is returned. |
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:pixiSetItemStatus>
<!-- <ItemNrInt>A-10045</ItemNrInt> -->
<!-- <ItemKey>4711</ItemKey> -->
<!-- <Enabled>0</Enabled> -->
<!-- <SupplierID>LIE1</SupplierID> -->
</ns1:pixiSetItemStatus>
</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:pixiSetItemStatus>
<!-- <ItemNrInt>A-10045</ItemNrInt> -->
<!-- <ItemKey>4711</ItemKey> -->
<!-- <Enabled>0</Enabled> -->
<!-- <SupplierID>LIE1</SupplierID> -->
</ns1:pixiSetItemStatus>
</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 = [
// 'ItemNrInt' => 'A-10045',
// 'ItemKey' => '4711',
// 'Enabled' => '0',
// 'SupplierID' => 'LIE1',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiSetItemStatus', $soapArguments);
- SQL object:
- dbo.pipiSetItemStatus