Add Application-Side Role
Permissions
The identity management API is authorized by application. Before calling the API, you need to set API permissions for different applications. For details, see API Permissions.
| Permission Code | Description |
|---|---|
| app_role_all | Read/Write permission for application-side role APIs |
| all | Read/Write permission for all APIs |
Request
Request Headers
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| Authorization | Authorization | Yes | String | Format: Bearer {access_token} |
| Content-Type | Content Type | Yes | String | Fixed value: application/json; charset=utf-8 |
Request Example
json
{
"code": "admin1",
"name": "Administrator 1"
}Request Parameters
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| app_id | Application ID | Yes | String | Target application ID |
| code | Application-side role code | Yes | String | Unique, max length 50 |
| name | Application-side role name | Yes | String | Max length 50 |
Response Example
Success Example
HTTP/1.1 200 OK
json
{
"role_id": "20220420140745089-23E4-DFF0A1900"
}Error Example
HTTP/1.1 400 Bad Request
json
{
"error_code": " APP.ROLE.0005",
"error_msg": "Application role code already exists"
}Response Parameters
| Parameter Name | Name | Type | Description |
|---|---|---|---|
| role_id | Application role ID | String |
Error Codes
| Status Code | Error Code | Chinese Error Message | English Error Message | Resolution |
|---|---|---|---|---|
| 400 | APP.ROLE.0005 | 应用角色编码已存在 | Application role code already exists | Please use a different application role code |
| 400 | APP.OBJECTMODEL.0006 | 未开启应用角色模型 | The application role model is not opened | Please check whether the application role model is enabled |
| 400 | APP.0001 | 应用不存在 | App does not exist | Please check whether the application has been deleted |