pixiTagMatchDeleteForOrders
Removes tag assignments (TagMatch) from orders for the tag/order pairs passed as XML and returns one status row per pair.
Deletes the assignment of order tags to orders. The pairs are passed in TagsXML; every Tag element below /Tags/Order/TagList is one request entry.
Steps:
- The XML is read element-centric. For each
TagtheTagIdis taken from theTagelement,OrderIdandOrderNrExternalfrom the parentOrderelement. ATagIdorOrderIdof0and an emptyOrderNrExternalare treated as missing. - The order is resolved in
OrderHeader: byOrderNr=OrderIdand byOrderNrExternal. The order header key found viaOrderIdtakes precedence; if none is found, the key found viaOrderNrExternalis used. If onlyOrderNrExternalis given, the returnedOrderIdis theOrderNrof the matched order. - Each entry is validated:
- no
TagId, or neitherOrderIdnorOrderNrExternal→ErrorMandatory parameter is missing - order not found, or tag not found as an order tag (
Tag.TypeId = 2) →ErrorOne of the provided values is not valid
- no
- For valid entries an existing
TagMatchrow with this tag and order header is looked up. If it exists, the entry getsSuccessTag was successfully removed from order and theTagMatchrow is deleted. If it does not exist, the entry getsWarningTag is not assigned to that order. - One result row per entry is returned, sorted in the order of the entries in the XML.
Notes
- Only tags with
TypeId = 2(order tags) are considered. - The call runs in its own transaction, or in a savepoint if a transaction is already open.
- If an unexpected error occurs (e.g. malformed XML), the transaction is rolled back, the error is logged via
log.InsertError(not attached) and no result set is returned. The textUnexpected error: "…"is built internally but not selected. - Lookups in
OrderHeader,TagandTagMatchuseNOLOCK; the delete usesROWLOCK. - If several orders share the same
OrderNrExternal, the entry can produce several result rows and the tag is removed from all matching orders. - The same tag/order pair listed twice returns
Successfor both entries; theTagMatchrow is deleted once. - The header comment of the procedure says Create TagMatch for Order, but the code only deletes assignments.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
TagsXML
|
varchar(max) xml |
NULL |
XML document with the orders and the tags to remove. Each Example:
|
Result set 1 · On success (not returned if an unexpected error occurs)
One status row per Tag entry of the XML, ordered by the position in the XML.
| Column | Type | Description |
|---|---|---|
TagId
Nullable |
int |
Tag ID from the XML (NULL if missing or 0). |
OrderId
Nullable |
int |
Order number ( |
OrderNrExternal
Nullable |
varchar(50) string |
External order number from the XML. |
OrderHeaderKey
Nullable |
int |
Internal key of the resolved order; NULL if the order was not found. |
Status
|
varchar(254) string |
|
Message
|
varchar(2000) string |
Result message for the entry. |
Response example
<SqlRowSet1>
<row>
<TagId>7</TagId>
<OrderId>104512</OrderId>
<OrderNrExternal>SHOP-2024-0815</OrderNrExternal>
<OrderHeaderKey>98765</OrderHeaderKey>
<Status>Success</Status>
<Message>Tag was successfully removed from order</Message>
</row>
<row>
<TagId>12</TagId>
<OrderId>104512</OrderId>
<OrderNrExternal>SHOP-2024-0815</OrderNrExternal>
<OrderHeaderKey>98765</OrderHeaderKey>
<Status>Warning</Status>
<Message>Tag is not assigned to that order</Message>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | Mandatory parameter is missing | The entry has no `TagId`, or neither `OrderId` nor `OrderNrExternal` is given (0 and empty strings count as missing). |
| Error | One of the provided values is not valid | The order cannot be found via `OrderId`/`OrderNrExternal`, or the `TagId` does not exist as an order tag (`TypeId = 2`). |
| Warning | Tag is not assigned to that order | Tag and order are valid, but there is no assignment to remove. |
| Error | Something went wrong, an undefined error occurred | Fallback message for an entry that fails validation without matching any specific rule. |
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:pixiTagMatchDeleteForOrders>
<!-- <TagsXML><![CDATA[<Tags><Order><OrderId>104512</OrderId><OrderNrExternal>SHOP-2024-0815</OrderNrExternal><TagList><Tag><TagId>7</TagId></Tag><Tag><TagId>12</TagId></Tag></TagList></Order></Tags>]]></TagsXML> -->
</ns1:pixiTagMatchDeleteForOrders>
</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:pixiTagMatchDeleteForOrders>
<!-- <TagsXML><![CDATA[<Tags><Order><OrderId>104512</OrderId><OrderNrExternal>SHOP-2024-0815</OrderNrExternal><TagList><Tag><TagId>7</TagId></Tag><Tag><TagId>12</TagId></Tag></TagList></Order></Tags>]]></TagsXML> -->
</ns1:pixiTagMatchDeleteForOrders>
</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 = [
// 'TagsXML' => '<Tags><Order><OrderId>104512</OrderId><OrderNrExternal>SHOP-2024-0815</OrderNrExternal><TagList><Tag><TagId>7</TagId></Tag><Tag><TagId>12</TagId></Tag></TagList></Order></Tags>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiTagMatchDeleteForOrders', $soapArguments);
- SQL object:
- dbo.pipiTagMatchDeleteForOrders