humanresources.node.member.add
Добавить участников в отдел
Описание
Метод относится к REST 3.0. Особенности вызова и формат ответа новой версии API описаны в обзоре REST 3.0.
Метод humanresources.node.member.add добавляет пользователей в отдел или команду.
Параметры
nodeId
integer
обязательный
Идентификатор отдела или команды.
Идентификатор можно получить методом humanresources.node.list
userIds
array
обязательный
Массив идентификаторов пользователей, которых нужно добавить в отдел или команду. Если пользователь уже состоит в этом отделе или команде, метод обновит его роль.
Идентификаторы пользователей можно получить методом user.get
role
string
обязательный
Роль, которую нужно назначить всем пользователям из userIds.
Возможные значения для отдела:
MEMBER_HEAD— руководитель отделаMEMBER_DEPUTY_HEAD— заместитель руководителя отделаMEMBER_EMPLOYEE— сотрудник отдела
Возможные значения для команды:
MEMBER_TEAM_HEAD— руководитель командыMEMBER_TEAM_DEPUTY_HEAD— заместитель руководителя командыMEMBER_TEAM_EMPLOYEE— участник команды
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"nodeId":15,"userIds":[7,12,18],"role":"MEMBER_EMPLOYEE"}' \
https://**put_your_bitrix24_address**/rest/api/**put_your_user_id_here**/**put_your_webhook_here**/humanresources.node.member.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"nodeId":15,"userIds":[7,12,18],"role":"MEMBER_EMPLOYEE","auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/api/humanresources.node.member.add
// 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 NodeMemberAddResult = {
success: boolean
}
try {
const response = await $b24.actions.v3.call.make<NodeMemberAddResult>({
method: 'humanresources.node.member.add',
params: {
nodeId: 15,
userIds: [7, 12, 18],
role: 'MEMBER_EMPLOYEE',
},
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('Members added successfully:', result.success)
}
} 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 addNodeMembers() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v3.call.make({
method: 'humanresources.node.member.add',
params: {
nodeId: 15,
userIds: [7, 12, 18],
role: 'MEMBER_EMPLOYEE',
},
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('Members added successfully:', result.success)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', addNodeMembers)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.humanresources.node.member.add(
node_id=15,
user_ids=[
7,
12,
18,
],
role='MEMBER_EMPLOYEE',
).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(
'humanresources.node.member.add',
[
'nodeId' => 15,
'userIds' => [7, 12, 18],
'role' => 'MEMBER_EMPLOYEE',
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error: ' . $e->getMessage();
}
BX24.callMethod(
'humanresources.node.member.add',
{
nodeId: 15,
userIds: [7, 12, 18],
role: 'MEMBER_EMPLOYEE'
},
function(result){
console.info(result.data());
console.log(result);
}
);
require_once('crest.php');
$result = CRest::call(
'humanresources.node.member.add',
[
'nodeId' => 15,
'userIds' => [7, 12, 18],
'role' => 'MEMBER_EMPLOYEE',
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "humanresources.node.member.add", b24.Params{
"nodeId": 15,
"userIds": []int{7, 12, 18},
"role": "MEMBER_EMPLOYEE",
})
if err != nil {
return fmt.Errorf("humanresources.node.member.add: %w", err)
}
var item struct {
Success bool `json:"success"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.Success)
Ответ
HTTP-статус: 200
{
"result": {
"success": true
},
"time": {
"start": 1780405600,
"finish": 1780405600.184422,
"duration": 0.18442201614379883,
"processing": 0.12311410903930664,
"date_start": "2026-06-02T16:06:40+03:00",
"date_finish": "2026-06-02T16:06:40+03:00",
"operating_reset_at": 1780406200,
"operating": 0
}
}
Возвращаемые данные
result
object
Объект с результатом операции
success
boolean
Значение true, если пользователи успешно добавлены в отдел или команду
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error": {
"code": "BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION",
"message": "Ошибка при валидации объекта запроса",
"validation": [
{
"message": "Parameter \"role\" is required.",
"field": "role"
}
]
}
}
| Код | Описание | Значение |
|---|---|---|
Поле |
Описание ошибки | Как исправить |
nodeId |
Parameter "nodeId" is required. |
Передайте идентификатор отдела или команды в параметре nodeId |
userIds |
Parameter "userIds" is required and must be a non-empty array. |
Передайте непустой массив идентификаторов пользователей |
role |
Parameter "role" is required. |
Передайте роль участника в параметре role |
role |
Role #ROLE# not found. |
Передайте существующую роль для выбранного типа отдела или команды |
role |
Invalid role #ROLE#. Allowed: #ROLE_LIST#. |
Передайте роль, которая поддерживается для выбранного типа отдела или команды |

