#Departments
Entity: department | Scope: department | Base path: /v1/departments
Legacy entity (UPPER_CASE field names) — field names are automatically converted to camelCase.
#Operations
| Method | Path | Description | Bitrix24 Method |
|---|---|---|---|
GET |
/v1/departments |
List all (with filter, sort, pagination) | department.get |
GET |
/v1/departments/:id |
Get by ID | department.get |
POST |
/v1/departments |
Create new | department.add |
PATCH |
/v1/departments/:id |
Update by ID | department.update |
DELETE |
/v1/departments/:id |
Delete by ID | department.delete |
#Fields
| API Name | Bitrix24 Name | Type | Readonly | Description |
|---|---|---|---|---|
id |
ID |
number | yes | Идентификатор записи |
name |
NAME |
string | ||
parentId |
PARENT |
number | ||
headId |
UF_HEAD |
number | ||
sort |
SORT |
number |
#Examples
#List
curl -X GET '/v1/departments?limit=10' \
-H 'X-Api-Key: YOUR_KEY'
#Get by ID
curl -X GET '/v1/departments/123' \
-H 'X-Api-Key: YOUR_KEY'
#Create
curl -X POST '/v1/departments' \
-H 'X-Api-Key: YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"value","parentId":1,"headId":1}'
#Update
curl -X PATCH '/v1/departments/123' \
-H 'X-Api-Key: YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{"title":"updated"}'
#Delete
curl -X DELETE '/v1/departments/123' \
-H 'X-Api-Key: YOUR_KEY'
#Batch
curl -X POST '/v1/batch' \
-H 'X-Api-Key: YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{"calls":[{"entity":"departments","action":"list","params":{"limit":5}}]}'