Update status sale.status.update
Scope:
saleWho can execute the method: administrator
This method updates the status of an order or delivery.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Symbolic identifier of the status |
|
fields* |
Field values for updating the status |
Parameter fields
Required parameters are marked with *
|
Name |
Description |
|
type* |
Status type:
|
|
notify |
Indicator of whether to send an email notification to the user when the order or delivery transitions to this status. Possible values:
|
|
sort |
Sorting |
|
color |
HEX color code of the status (e.g., |
|
xmlId |
External code of the status. Can be used for synchronization with the order or delivery status by identifier in an external system |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":"MS","fields":{"type":"D","notify":"N","sort":100,"color":"#00FF00","xmlId":"updatedXmlId"}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/sale.status.update
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":"MS","fields":{"type":"D","notify":"N","sort":100,"color":"#00FF00","xmlId":"updatedXmlId"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/sale.status.update
try
{
const response = await $b24.callMethod(
'sale.status.update', {
id: 'MS',
fields: {
type: 'D',
notify: 'N',
sort: 100,
color: '#00FF00',
xmlId: 'updatedXmlId',
}
}
);
const result = response.getData().result;
console.info(result);
}
catch( error )
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'sale.status.update',
[
'id' => 'MS',
'fields' => [
'type' => 'D',
'notify' => 'N',
'sort' => 100,
'color' => '#00FF00',
'xmlId' => 'updatedXmlId',
],
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
// Your required data processing logic
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error updating sale status: ' . $e->getMessage();
}
BX24.callMethod(
'sale.status.update', {
id: 'MS',
fields: {
type: 'D',
notify: 'N',
sort: 100,
color: '#00FF00',
xmlId: 'updatedXmlId',
}
},
function(result) {
if (result.error()) {
console.error(result.error());
} else {
console.info(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call('sale.status.update', [
'id' => 'MS',
'fields' => [
'type' => 'D',
'notify' => 'N',
'sort' => 100,
'color' => '#00FF00',
'xmlId' => 'updatedXmlId',
]
]);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result": {
"status": {
"color": "#00FF00",
"id": "MS",
"notify": "N",
"sort": 100,
"type": "D",
"xmlId": "updatedXmlId"
}
},
"time": {
"start": 1712142575.655577,
"finish": 1712142575.940234,
"duration": 0.28465700149536133,
"processing": 0.02240896224975586,
"date_start": "2024-04-03T14:09:35+02:00",
"date_finish": "2024-04-03T14:09:35+02:00"
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response |
|
status |
Object with information about the updated status |
|
time |
Information about the execution time of the request |
Error Handling
HTTP status: 400
{
"error": 0,
"error_description": "Required fields: type"
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Description |
|
|
Status with the provided identifier not found |
|
|
Insufficient permissions to update the status |
|
|
Status type value not provided or the provided value is incorrect |
|
|
Error occurs when trying to change the type of certain system statuses:
|
|
|
Error occurs when trying to change the order status type if orders are already attached to this status |
|
|
Error occurs when trying to change the delivery status type if deliveries are already attached to this status |
|
|
Parameter |
|
|
Parameter |
|
|
Required fields of the |
|
|
Other errors (e.g., fatal errors) |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Statuses in the Online Store: Overview of Methods
- Create status sale.status.add
- Get Values of All Status Fields by ID sale.status.get
- Get the list of statuses sale.status.list
- Delete Status sale.status.delete
- Get Available Fields of sale.status.delete