Request
| Basic information | |
|---|---|
| HTTP URL | https://oapi.dingtalk.io/topapi/role/addrolesforemps |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi_manage_addresslist-Contacts data management permission |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | 6d1bxxxx | The app credential used to call this API. Obtain it through the API for getting the access_token of an internal app. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| roleIds | String | Yes | 1507113584 | The list of role IDs (roleId). Call the Get the list of roles API to obtain them. Separate multiple roleId values with commas (,). Up to 20 values are allowed. |
| userIds | String | Yes | user1 | The userId of an employee. Call Query users by phone number to obtain it. Separate multiple userId values with commas (,). Up to 20 values are allowed. |
Request example
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | emhw6ma4xmeg | The request ID. |
Response body example
Error codes
If an error occurs when you call this API, refer to the Global error codes document to find a solution based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 33011 | Invalid roleIds | Check whether the roleIds are correct. |
| 33012 | Invalid userIds | Check whether the userId values are correct. |
| 12012 | The organization does not exist | Check whether the access_token is correct. |
| 1002 | System busy | Try again later. |