1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-16 11:38:11 +02:00
OpenIntegrations/docs/en/md/Bitrix24/Departments-managment/Get-departments.md

77 lines
1.9 KiB
Markdown
Raw Normal View History

---
sidebar_position: 3
---
# 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`
| Parameter | CLI option | Type | Destination |
|-|-|-|-|
| URL | --url | String | URL of webhook or a Bitrix24 domain, when token used |
| DepartmentID | --depid | String, Number | Selection by department ID |
| Name | --title | String | Filter by name |
| ParentID | --parentid | String, Number | Filter by parent ID |
| HeadID | --headid | String, Number | Filter by manager ID |
| Token | --token | String | Access token, when app auth method used |
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
<br/>
:::tip
Method at API documentation: [department.get](https://dev.1c-bitrix.ru/rest_help/departments/department_get.php)
:::
<br/>
```bsl title="Code example"
URL = "https://b24-ar17wx.bitrix24.by/rest/1/f2ppp8uucc891111/";
DepartmentID = "70";
Result = OPI_Bitrix24.GetDepartments(URL, DepartmentID);
URL = "b24-ar17wx.bitrix24.by";
Token = "fe3fa966006e9f06006b12e400000001000...";
HeadID = 1;
Result = OPI_Bitrix24.GetDepartments(URL,,,, HeadID, Token);
```
```sh title="CLI command example"
oint bitrix24 GetDepartments --url %url% --depid %depid% --title %title% --parentid %parentid% --headid %headid% --token %token%
```
```json title="Result"
{
"result": [
{
"ID": "42",
"NAME": "Subordinate department",
"SORT": 500,
"PARENT": "40",
"UF_HEAD": "1"
}
],
"total": 1,
"time": {
"start": 1722171478.80371,
"finish": 1722171478.83794,
"duration": 0.034229040145874,
"processing": 0.00419092178344727,
"date_start": "2024-07-28T12:57:58+00:00",
"date_finish": "2024-07-28T12:57:58+00:00",
"operating_reset_at": 1722172078,
"operating": 0
}
}
```