Get list of departments
Updated date: 18/08/2026
Updated by: VNPT eContract's team
Purpose
The function performs retrieving a list of company departments.
- Request URL:
/api/departments - HTTP method:
GET - Authorize:
Bearer token - Parameter: Not required, but additional options can be added below to filter or search the list of departments.
| Key | Type | Description |
|---|---|---|
search | string | Search information by department name |
page | int | Page number (default is 1) |
pagesize | int | Page size (default is 10 records) |
Sample request
Query param:
page: 1
pageSize: 10
search: dochub
Request: /api/departments?page=1&pageSize=10&search=dochub
Sample response body
{
"data": {
"items": [
{
"id": 33,
"name": "DocHub",
"code": "DHB",
"userCount": 2,
"users": [
{
"id": 6,
"createdDate": "2021-01-06T17:06:07.2893325",
"comId": 164,
"code": "USER01",
"name": "Nguyen Van A",
"phone": "",
"email": "email_address",
"username": "username1",
"isSelected": false
},
{
"id": 19,
"createdDate": "2021-01-08T16:09:39.9081934",
"comId": 164,
"code": "USER02",
"name": "Nguyen Van B",
"phone": "0919XXXXXX",
"email": "email_address",
"username": "username2",
"isSelected": false
}
]
}
],
"totalCount": 1,
"pageCount": 1,
"page": 1,
"pageSize": 10,
"hasNextPage": false,
"hasPreviousPage": false
},
"success": true,
"code": 0,
"messages": []
}
Response Body Description
| Key | Type | Description |
|---|---|---|
success | boolean | Response status (true: Success, false: Failure) |
code | int | Response code from the system |
messages | array | List of messages returned by the system |
data | object | Object containing the list of departments and pagination data (see details below) |
Details of data:
| Key | Type | Description |
|---|---|---|
items | array | List of detailed department information (see details below) |
totalCount | int | Total number of departments matching the filter criteria |
pageCount | int | Total number of pages |
page | int | Current page |
pageSize | int | Number of records per page |
hasNextPage | boolean | Whether there is a next page (true: Yes, false: No) |
hasPreviousPage | boolean | Whether there is a previous page (true: Yes, false: No) |
Details of objects in the items array:
| Key | Type | Description |
|---|---|---|
id | int | Department ID |
name | string | Department name |
code | string | Department code |
userCount | int | Total number of users belonging to the department |
users | array | List of users belonging to the department (see details below) |
Details of objects in the users array:
| Key | Type | Description |
|---|---|---|
id | int | User ID |
createdDate | string | User account creation time (ISO 8601 format) |
comId | int | Company ID |
code | string | User code |
name | string | User name |
phone | string | User phone number (if available) |
email | string | User email address |
username | string | User login name |