Skip to main content

Get departments

Gets a list of departments by ID or filter

Function GetDepartments(Val URL, Val DepartmentID = "", Val Name = "", Val ParentID = "", Val HeadID = "", Val Token = "") Export

ParameterCLI optionTypeRequiredDescription
URL--urlStringURL of webhook or a Bitrix24 domain, when token used
DepartmentID--depidString, NumberSelection by department ID
Name--titleStringFilter by name
ParentID--parentidString, NumberFilter by parent ID
HeadID--headidString, NumberFilter by manager ID
Token--tokenStringAccess token, when app auth method used

Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API


tip

Method at API documentation: department.get


1C:Enterprise/OneScript code example
    URL          = "https://b24-ar17wx.bitrix24.by/rest/1/yg2...";
DepartmentID = "1070";

Result = OPI_Bitrix24.GetDepartments(URL, DepartmentID);

URL = "b24-ar17wx.bitrix24.by";
Token = "2f4e4067006e9f06006b12e400000001000...";
HeadID = 1;

Result = OPI_Bitrix24.GetDepartments(URL, , , , HeadID, Token);
    oint bitrix24 GetDepartments \
--url "b24-ar17wx.bitrix24.by" \
--headid 1 \
--token "***"
Result
{
"result": [
{
"ID": "594",
"NAME": "Subordinate department",
"SORT": 500,
"PARENT": "592",
"UF_HEAD": "1"
}
],
"total": 1,
"time": {
"start": 1728454927.4735,
"finish": 1728454927.50699,
"duration": 0.0334928035736084,
"processing": 0.00784516334533691,
"date_start": "2024-10-09T09:22:07+03:00",
"date_finish": "2024-10-09T09:22:07+03:00",
"operating_reset_at": 1728455527,
"operating": 0
}
}