pixiTagMatchDeleteForItems
Removes tag assignments (TagMatch) from items for a list of tag/item pairs passed as XML and returns a status row per pair.
Deletes the assignment of item tags to items in bulk.
Input
TagsXML contains one Item element per item, each with a TagList of Tag elements. Every Tag element is one request (tag/item pair). The item is identified either by ItemId (the item key) or by ItemNrInt (internal item number, looked up in ItemCode with code type 2). If ItemId is given, it takes precedence over ItemNrInt. Values 0 for TagId/ItemId and empty ItemNrInt are treated as missing.
Validation per pair
TagIdmissing, or neitherItemIdnorItemNrIntgiven →Error/ Mandatory parameter is missing.ItemNrIntgiven but not found,ItemIdnot found initems, orTagIdnot an existing tag of type1(item tag) →Error/ One of the provided values is not valid.- Tag and item valid and an assignment exists in
TagMatch→ assignment is deleted,Success/ Tag was successfully removed from item. - Tag and item valid but no assignment exists →
Warning/ Tag is not assigned to that item.
Output
One result set with one row per processed Tag element (ordered by the position in the XML) containing TagId, the resolved ItemId, the given ItemNrInt, Status and Message. Invalid pairs do not stop the processing of the other pairs.
Notes
- The whole call runs in a transaction (
XACT_ABORT ON); if called inside an existing transaction, a savepoint is used instead. - On an unexpected SQL error the transaction is rolled back and the error is written to the error log via
log.InsertError. The procedure does not return a result set in this case, so an empty response must be treated as failure. - If
TagsXMLis omitted (NULL) or contains noTagelements, nothing is deleted and no rows (or no result set) are returned. - When
ItemIdandItemNrIntare both given, onlyItemIdis used; consistency between the two is not checked. - If an
ItemNrIntmatches several items inItemCode, the pair can produce several result rows. - Lookups use
NOLOCK; the delete usesROWLOCK. - Only tags with
TypeId = 1(item tags) are considered.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
TagsXML
|
varchar(max) xml |
NULL |
XML document with the items and the tags to remove. Path Example:
|
Result set 1 · On success (no unexpected SQL error); one row per Tag element in the XML
Processing result for each requested tag/item pair, ordered by position in the XML.
| Column | Type | Description |
|---|---|---|
TagId
Nullable |
int |
Tag ID from the XML ( |
ItemId
Nullable |
int |
Item key, either given in the XML or resolved from |
ItemNrInt
Nullable |
varchar(50) string |
Internal item number as given in the XML. |
Status
|
varchar(254) string |
|
Message
|
varchar(2000) string |
Message text for the status. |
Response example
<SqlRowSet1>
<row>
<TagId>5</TagId>
<ItemId>1234</ItemId>
<Status>Success</Status>
<Message>Tag was successfully removed from item</Message>
</row>
<row>
<TagId>7</TagId>
<ItemId>1234</ItemId>
<Status>Warning</Status>
<Message>Tag is not assigned to that item</Message>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | Mandatory parameter is missing | The `Tag` element has no `TagId` (or 0), or the `Item` has neither `ItemId` nor `ItemNrInt`. Provide both a tag and an item identifier. |
| Error | One of the provided values is not valid | The `ItemNrInt` was not found, the `ItemId` does not exist in `items`, or the `TagId` is not an existing item tag (type 1). |
| Warning | Tag is not assigned to that item | Tag and item are valid, but there is no assignment in `TagMatch` to delete. |
| Error | Something went wrong, an undefined error occurred | Fallback message for a row without a defined status; not expected in normal operation. |
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:pixiTagMatchDeleteForItems>
<!-- <TagsXML><![CDATA[<Tags><Item><ItemId>1234</ItemId><ItemNrInt></ItemNrInt><TagList><Tag><TagId>5</TagId></Tag><Tag><TagId>7</TagId></Tag></TagList></Item><Item><ItemId>0</ItemId><ItemNrInt>A-10001</ItemNrInt><TagList><Tag><TagId>5</TagId></Tag></TagList></Item></Tags>]]></TagsXML> -->
</ns1:pixiTagMatchDeleteForItems>
</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:pixiTagMatchDeleteForItems>
<!-- <TagsXML><![CDATA[<Tags><Item><ItemId>1234</ItemId><ItemNrInt></ItemNrInt><TagList><Tag><TagId>5</TagId></Tag><Tag><TagId>7</TagId></Tag></TagList></Item><Item><ItemId>0</ItemId><ItemNrInt>A-10001</ItemNrInt><TagList><Tag><TagId>5</TagId></Tag></TagList></Item></Tags>]]></TagsXML> -->
</ns1:pixiTagMatchDeleteForItems>
</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><Item><ItemId>1234</ItemId><ItemNrInt></ItemNrInt><TagList><Tag><TagId>5</TagId></Tag><Tag><TagId>7</TagId></Tag></TagList></Item><Item><ItemId>0</ItemId><ItemNrInt>A-10001</ItemNrInt><TagList><Tag><TagId>5</TagId></Tag></TagList></Item></Tags>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiTagMatchDeleteForItems', $soapArguments);
- SQL object:
- dbo.pipiTagMatchDeleteForItems