Call this API to query the list of departments in an organization.
Supported editions | Enterprise Dedicated Edition |
Service endpoints and authorization
Get the service endpoint to replace <domain> in the API request syntax with your endpoint.
Obtain the access token.
Obtain the
organizationId. Go to the Lingma console and view the organization ID on the Basic Information page under .
Product | Resource | Required permission |
Organization settings | Departments | Read-Only |
Request syntax
GET https://{domain}/oapi/v1/platform/departmentsRequest headers
Parameter | Type | Required | Description | Example |
| string | Yes | The access token. | pt-0fh3****0fbG_35af****0484 |
Request parameters
Parameter | Type | Position | Required | Description | Example |
| string | query | No | The parent department ID. | 99d1****6124 |
| integer | query | No | The page number. Default value: 1. | 1 |
| integer | query | No | The number of entries per page. Valid values: 1 to 100. Default value: 100. | 10 |
Sample request
curl -X 'GET' \
'https://<domain>/oapi/v1/platform/departments?parentId={parentId}&page={page}&perPage={perPage}' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'Response parameters
Parameter | Type | Description | Example |
- | array | ||
- | object | ||
| string | The ID of the user who created the department list. | 99d1****6124 |
| boolean | Indicates whether the department has subdepartments. | true |
| string | The department ID. | 99d1****6124 |
| string | The department name. | Example Name |
| string | The ID of the parent department under which the subdepartments are created. | 99d1****6124 |
| string | The type of the department. For example, | ROOT |
Sample success responses
[
{
"creatorId": "99d1****6124",
"hasSub": true,
"id": "99d1****6124",
"name": "Example Name",
"parentId": "99d1****6124",
"type": "ROOT"
}
]Response headers
Parameter | Description | Example |
| The next page. | 2 |
| The page number. | 1 |
| The number of entries returned per page. | 20 |
| The previous page. | 0 |
| The request ID. | 37294673-00CA-5B8B-914F-A8B35511E90A |
| The total number of entries. | 10 |
| The total number of pages. | 1 |
Error codes
For more information, see Error codes.