ListSysDepts - List departments

Updated at:

Retrieves a list of departments in an organization.

Important

The new Qoder CN documentation site is now available. Content on this site may not reflect the latest product features and changes. Visit docs.qoder.cn for the latest product documentation.

Supported editions

Enterprise Dedicated Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint.

Authorization

Product

Resource

Required permission

Organization settings

Departments

Read-Only

Request syntax

GET https://{domain}/oapi/v1/platform/departments?parentId={parentId}&page={page}&perPage={perPage}

Request details

List top-level departments

curl -X 'GET' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/platform/departments' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

List subdepartments

curl -X 'GET' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/platform/departments?parentId=ebeb5a64-c98c-478a-9d9d-513841da****&page=1&perPage=100' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Request headers

x-yunxiao-token string (Required)

The access token. See Access token for details.

Example: pt-0fh3****0fbG_35af****0484.

Query parameters

parentId string (Optional)

The ID of the parent department.

  • If you do not specify this parameter, the API returns a list of top-level departments.

  • If you specify this parameter, the API returns a list of immediate subdepartments. If the department has no subdepartments, the API returns an empty list.

page integer (Optional) Default: 1

The page number of the results to return.

perPage integer (Optional) Default: 100

The number of items to return per page. Valid values: [1, 100].

Response parameters

Response example

[
    {
        "id": "204769ba-7f70-478b-a7af-4513281c****",
        "name": "Sample Department 1",
        "creatorId": "bf2fce4f-7048-4017-a734-1c346e68****",
        "parentId": "ebeb5a64-c98c-478a-9d9d-513841da****"
    },
    {
        "id": "f2f160ea-2d00-4b00-addd-1d89a760****",
        "name": "Sample Department 2",
        "creatorId": "2e625bbd-c1a8-41de-b734-2558e72f****",
        "parentId": "ebeb5a64-c98c-478a-9d9d-513841da****",
        "hasSub": true
    }
]

id string

The unique ID of the department.

name string

The name of the department.

creatorId string

The ID of the user who created the department.

parentId string

The ID of the parent department.

hasSub boolean

Indicates whether the department has subdepartments.

  • true: The department has subdepartments.

  • This parameter is omitted if the department has no subdepartments.

Response headers

Parameter

Description

Example value

x-next-page

The next page

2

x-page

The current page

1

x-per-page

The number of entries per page

100

x-prev-page

The previous page

0

x-request-id

The request ID

37294673-00CA-5B8B-914F-A8B35511E90A

x-total

The total number of entries

10

x-total-pages

The total number of pages

1

Error codes

For more information, see Error code center.