Query the list of organization departments through the OpenAPI.
Applies to: Enterprise Dedicated Edition, Enterprise Standard Edition
Access Point: Get the service endpoint and replace {domain} in the API request syntax.
Authorization
| Product | Resource | Required permission |
|---|
| Organization Management | Organization departments | Read-only |
Request Syntax
GET https://{domain}/oapi/v1/platform/organizations/{organizationId}/departments
Request Description
curl -X 'GET' \
'https://openapi-rdc.aliyuncs.com/oapi/v1/platform/organizations/9a2b****5ef1/departments' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
curl -X 'GET' \
'https://openapi-rdc.aliyuncs.com/oapi/v1/platform/organizations/9a2b****5ef1/departments?parentId=99d1****71d4' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
curl -X 'GET' \
'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/platform/organizations/9a2b****5ef1/departments' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
curl -X 'GET' \
'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/platform/organizations/9a2b****5ef1/departments?parentId=99d1****71d4&page=1&perPage=100' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
x-yunxiao-token string (Required)
Personal access token. See the personal access token documentation for details.
Example: pt-0fh30fbG_35af0484.
Request Parameters
organizationId
string
(Required)
Organization ID. You can go to the Basic Information page in the Organization Management console to obtain the organization ID (organizationId).
parentIdstring(Optional)
Parent department ID.
pageinteger(Optional) Default: 1
[Dedicated Edition only] Current page.
perPageinteger(Optional) Default: 100
[Dedicated Edition only] Number of entries per page. Valid values: [1, 100].
Response Fields
[
{
"creatorId": "99d1****6124",
"hasSub": true,
"id": "99d1****6124",
"name": "Example",
"organizationId": "99d1****6124",
"parentId": "99d1****6124"
}
]
creatorId
string
Creator ID.
hasSub
boolean
Whether the department has subdepartments.
id
string
Department ID.
name
string
Department name.
organizationId
string
Organization ID.
parentId
string
Parent department ID.
| Parameter | Description | Example value |
|---|
| x-next-page | [Dedicated Edition only] Next page. | 1 |
| x-page | [Dedicated Edition only] Current page. | 2 |
| x-per-page | [Dedicated Edition only] Number of entries per page. | 1 |
| x-prev-page | [Dedicated Edition only] Previous page. | 2 |
| x-total | [Dedicated Edition only] Total number of entries. | 1 |
| x-total-pages | [Dedicated Edition only] Total number of pages. | 10 |
Error Codes
Visit to view the API-related error codes.