метод REST
scope: sale
sale.shipmentproperty.get
Получить свойство отгрузки
Описание
Метод sale.shipmentproperty.get получает свойство отгрузки.
Параметры
id
sale_shipment_property.id
обязательный
Идентификатор свойства отгрузки
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":22}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/sale.shipmentproperty.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":22,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/sale.shipmentproperty.get
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of the payload returned in result (match the "response handling" section of the page)
type ShipmentPropertyGetResult = {
property: {
active: string
code: string
defaultValue: string
description: string
id: number
inputFieldLocation: string
isAddress: string
isAddressFrom: string
isAddressTo: string
isEmail: string
isFiltered: string
isLocation: string
isLocation4tax: string
isPayer: string
isPhone: string
isProfileName: string
isZip: string
multiple: string
name: string
personTypeId: number
propsGroupId: number
required: string
settings: unknown[]
sort: number
type: string
userProps: string
util: string
xmlId: string
}
}
try {
const response = await $b24.actions.v2.call.make<ShipmentPropertyGetResult>({
method: 'sale.shipmentproperty.get',
params: {
id: 22,
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info(result.property.id, result.property.name, result.property.type)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function getShipmentProperty() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'sale.shipmentproperty.get',
params: {
id: 22,
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info(result.property.id, result.property.name, result.property.type)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getShipmentProperty)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.sale.shipmentproperty.get(
bitrix_id=22,
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Ошибка Bitrix API",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
print(f"Непредвиденная ошибка: {error}")
try {
$response = $b24Service
->core
->call(
'sale.shipmentproperty.get',
[
'id' => 22,
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
// Нужная вам логика обработки данных
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting shipment property: ' . $e->getMessage();
}
BX24.callMethod(
"sale.shipmentproperty.get", {
"id": 22
},
function(result) {
if (result.error()) {
console.error(result.error());
} else {
console.info(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'sale.shipmentproperty.get',
[
'id' => 22
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "sale.shipmentproperty.get", b24.Params{
"id": 22,
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("sale.shipmentproperty.get: %w", err)
}
// Метод заворачивает ответ в объект с ключом "property".
raw, ok := b24.Unwrap(res.Result, "property")
if !ok {
return fmt.Errorf("в ответе нет ключа property")
}
var item struct {
Active string `json:"active"`
Code string `json:"code"`
DefaultValue string `json:"defaultValue"`
Description string `json:"description"`
ID b24.ID `json:"id"`
InputFieldLocation string `json:"inputFieldLocation"`
}
if err := json.Unmarshal(raw, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.Active, item.Code)
Ответ
HTTP-статус: 200
{
"result": {
"property": {
"active": "Y",
"code": "PHONE",
"defaultValue": "",
"description": "",
"id": 22,
"inputFieldLocation": "0",
"isAddress": "N",
"isAddressFrom": "N",
"isAddressTo": "N",
"isEmail": "N",
"isFiltered": "N",
"isLocation": "N",
"isLocation4tax": "N",
"isPayer": "N",
"isPhone": "Y",
"isProfileName": "N",
"isZip": "N",
"multiple": "N",
"name": "Телефон",
"personTypeId": 3,
"propsGroupId": 5,
"required": "Y",
"settings": [],
"sort": 120,
"type": "STRING",
"userProps": "Y",
"util": "N",
"xmlId": ""
}
},
"time": {
"start": 1712818820.026505,
"finish": 1712818820.232912,
"duration": 0.2064070701599121,
"processing": 0.018364906311035156,
"date_start": "2024-04-11T10:00:20+03:00",
"date_finish": "2024-04-11T10:00:20+03:00"
}
}
Возвращаемые данные
result
object
Корневой элемент ответа
property
sale_shipment_property
Информация о свойстве отгрузки
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error":200840400001,
"error_description":"property is not exists"
}
| Код | Описание | Значение |
|---|---|---|
200840400001 |
Свойство отгрузки не найдено | |
200040300010 |
Недостаточно прав для чтения свойства отгрузки | |
100 |
Не указан параметр id |
|
0 |
Другие ошибки (например, фатальные ошибки) |

