Request
| Basic information | |
|---|---|
| HTTP URL | https://oapi.dingtalk.io/role/add_role |
| 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 by calling the API for getting the access_token of an internal app. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| roleName | String | Yes | Service | The name of the role. |
| groupId | Number | Yes | 1507113595 | The ID of the role group. - If the target role group already exists, call the Get the list of roles API to obtain it. - If the role group has not been created, first call the Create a role group API to create one and obtain its ID. |
Request example
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| roleId | Number | 1688611118 | The ID of the role. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
Response body example
Error codes
If an error is returned when you call this API, find the solution in the Global error codes document based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 34018 | The role cannot be empty | Provide both roleName and groupId. |
| 34020 | Invalid groupId | Check whether groupId is correct. |
| 34021 | The role name already exists | Check whether roleName is correct. |
| -1 | System busy | Try again later. |