pixiCreateOrderComment
Adds a free-text comment to an existing order and records the user and timestamp of its creation.
Creates a new entry in the order comments for the given order.
Steps:
- Validation: if
OrderNris missing or0, orCommentis missing or empty, the call returns an error row and does nothing else. - Order check: the call counts the orders in
OrderHeaderwith the givenOrderNr. If there is none, it returns an error row that contains the order number. - Insert: otherwise it inserts one row into
OrderCommentswith the order number, the comment text, the value ofUseras creating employee (CreateEmp) and the current server time asCreateDate. - It then returns a single row with
ReturnCode=SUCCESS.
Each call adds a new comment. Existing comments are never changed or replaced.
Notes
- The header comment in the code says the procedure gets order comments; this is wrong. The procedure only inserts a comment.
- The shape of the result row differs: error rows have the columns
ReturnCodeandErrorMsg, the success row has onlyReturnCode. Clients should checkReturnCodefirst. - No explicit transaction is used. Calling the procedure again creates a duplicate comment, so retries after timeouts can lead to double entries.
CreateDateis set withCURRENT_TIMESTAMP, i.e. the local time of the database server.Commentisvarchar, notnvarchar; characters outside the database code page may be lost.- Because SQL Server ignores trailing spaces in string comparisons, a comment consisting only of spaces is rejected as empty.
- Values for
Userlonger than 50 characters are truncated by the parameter type. - The order is identified only by the internal
OrderNr; an external order number is not supported.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderNr
|
int | NULL |
Internal Pixi order number ( Example: |
Comment
|
varchar(max) string |
NULL |
Text of the comment. Must not be empty, otherwise an error row is returned. Example: |
User
|
varchar(50) string |
API |
Name or short code of the user stored as creator of the comment ( Example: |
Result set 1 · If OrderNr is missing/0 or Comment is empty, or if no order with OrderNr exists.
Error row; no comment is created.
| Column | Type | Description |
|---|---|---|
ReturnCode
|
varchar(5) string |
Always |
ErrorMsg
|
varchar(max) string |
Error text describing the problem. |
Result set 2 · On success, after the comment has been inserted.
Success row.
| Column | Type | Description |
|---|---|---|
ReturnCode
|
varchar(7) string |
Always |
Response example
<SqlRowSet1>
<row>
<ReturnCode>SUCCESS</ReturnCode>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR | Please provide an order number and a comment | `OrderNr` is missing or `0`, or `Comment` is missing or empty. Pass a valid order number and a non-empty comment. |
| ERROR | Couldnt find an order with order number {OrderNr} | No row in `OrderHeader` has the given `OrderNr`. Check that the internal Pixi order number (not the external shop order number) is used. |
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:pixiCreateOrderComment>
<!-- <OrderNr>104523</OrderNr> -->
<!-- <Comment>Customer requested delivery after 2 pm.</Comment> -->
<!-- <User>SHOP</User> -->
</ns1:pixiCreateOrderComment>
</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:pixiCreateOrderComment>
<!-- <OrderNr>104523</OrderNr> -->
<!-- <Comment>Customer requested delivery after 2 pm.</Comment> -->
<!-- <User>SHOP</User> -->
</ns1:pixiCreateOrderComment>
</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 = [
// 'OrderNr' => '104523',
// 'Comment' => 'Customer requested delivery after 2 pm.',
// 'User' => 'SHOP',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCreateOrderComment', $soapArguments);
- SQL object:
- dbo.pipiCreateOrderComment