Request
| Basic information | |
|---|---|
| HTTP URL | https://oapi.dingtalk.io/topapi/v2/department/listparentbyuser |
| HTTP Method | POST |
| Supported app types | appType-Internal appappType-Third-party enterprise app |
| Required permissions | permission-qyapi_get_department_list-Read permission for Contacts department information |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | bE74xxxx | The App credential used to call this API. - For an Internal app, obtain it through the API for getting the access_token of an Internal app. - For a Third-party enterprise app, obtain it through the API for getting the access_token of a Third-party enterprise. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| userid | String | Yes | 100 | The user ID of the user to query. |
Request example
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| errcode | Number | 0 | The return code. |
| request_id | String | nfe328zf67ec | The request ID. |
| errmsg | String | Invalid userid | The error message returned when the call failed. |
| result | DeptListParentByUserResponse | The returned result. | |
| parent_list | DeptParentResponse[] | The collection of parent department lists. | |
| parent_dept_id_list | Number[] | [456, 123, 1] | The parent department list. |
Response body example
Error codes
If an error occurs when calling this API, find the solution in the Global error codes document based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 43007 | Authorization required | Confirm that the access_token has the required Permissions. |
| 33012 | Invalid userId | Confirm that the userId is correct. |
| 400002 | Invalid parameter | Confirm that the parameter is entered as required. |
| -1 | System busy | Try again later. |