pixiTagDelete
Deletes a tag, identified by its ID or by type and name, and removes all of its assignments to items or orders.
Deletes one tag from Tag together with all of its assignments in TagMatch. Tags are used to label objects such as items (Artikel) or orders (Aufträge).
The tag can be identified in two ways:
- by
TagId, or - by the combination of
TypeIdandName. Both values are required together.
The parameters are checked in this order:
- If all three parameters are missing, or only one of
TypeIdandNameis passed, the call returns an error about missing mandatory parameters. - If
TagIdis passed but no tag with this ID exists, the call returns Tag does not exist. - If
TagIdis not passed and no tag matchesTypeIdandName, the call also returns Tag does not exist. - If the tag found is a system tag (
IsSystemTag= 1), it cannot be deleted. - If
TagIdandTypeId/Nameare all passed and point to two different tags, the call returns an error.
If all checks pass, the call first deletes every TagMatch row of the tag, which removes the tag from all assigned objects. It then deletes the tag itself. The call always returns a single row with Status and Message.
Notes
- The call runs in its own transaction. If a transaction is already open, it uses a savepoint instead. On an unexpected error the changes are rolled back, the error is logged via
log.InsertErrorandStatus=Erroris returned with the first 80 characters of the SQL error message. - Errors are never raised as
SqlMessage. Always evaluate theStatuscolumn. - Pitfall: if
TagIdis passed together with aTypeId/Namepair that matches no tag, the conflict check does not apply. In that case the tag withTagIdis deleted. - Passing
TagIdtogether with onlyTypeIdor onlyNamereturns the missing-parameters error, even thoughTagIdalone would be enough. - The checks read
TagwithNOLOCK. The deletes useROWLOCK. - The meaning of the
TypeIdvalues (for example item or order tags) is not defined in this code.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
TagId
|
int | NULL |
ID of the tag to delete. Alternative to the combination of Example: |
TypeId
|
int | NULL |
Type of the tag ( Example: |
Name
|
varchar(50) string |
NULL |
Name of the tag ( Example: |
Result set 1 · Always
One status row with the result of the delete operation.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(10) string |
|
Message
|
varchar(100) string |
Success message or error description. |
Response example
<SqlRowSet1>
<row>
<Status>Success</Status>
<Message>Tag was successfully deleted. Tag was also removed from assigned objects</Message>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | Tag could not be deleted. Mandatory parameters TypeId or Name or TagId are missing | No parameter was passed, or only one of `TypeId` and `Name` was passed. Pass either `TagId` or both `TypeId` and `Name`. |
| Error | Tag could not be deleted, Tag does not exist | No tag exists with the given `TagId`, or, if `TagId` is not passed, no tag matches `TypeId` and `Name`. |
| Error | System Tags (IsSystemTag) cannot be deleted | The tag found is marked as a system tag (`IsSystemTag` = 1). System tags cannot be deleted. |
| Error | Tag could not be deleted, use either TagId parameter or combination of TypeId and Name parameters | `TagId` and `TypeId`/`Name` point to two different existing tags. Pass only one way of identifying the tag. |
| Error | Unexpected error: "{error message}" | An unexpected SQL error occurred during the delete, for example a lock or constraint problem. The transaction is rolled back and the error is logged. |
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:pixiTagDelete>
<!-- <TagId>42</TagId> -->
<!-- <TypeId>1</TypeId> -->
<!-- <Name>Sale2024</Name> -->
</ns1:pixiTagDelete>
</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:pixiTagDelete>
<!-- <TagId>42</TagId> -->
<!-- <TypeId>1</TypeId> -->
<!-- <Name>Sale2024</Name> -->
</ns1:pixiTagDelete>
</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 = [
// 'TagId' => '42',
// 'TypeId' => '1',
// 'Name' => 'Sale2024',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiTagDelete', $soapArguments);
- SQL object:
- dbo.pipiTagDelete