Obtaining Roles and Permissions Corresponding to Resource Points
Function
This API is used to obtain roles and permissions corresponding to resource points.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET https://{hostURL}/v4/groups/{group_id}/permissions-resources/{resource_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| group_id | Yes | Integer | Definition Repository group ID, which is the numeric ID next to Group ID on the repository group homepage. Value range: 1~2147483647 |
| resource_id | Yes | Integer | Definition Resource ID, which is the ID in the data obtained from the API for obtaining the repository group permission resource point list. Value range: 1~2147483647 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| offset | No | Integer | Definition Offset, which starts from 0. Value range: 0~2147483647 Default value: 0 |
| limit | No | Integer | Definition Number of returned records. Value range: 1~100 Default value: 20 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints Mandatory. Range 1–100,000 characters. Default Value N/A. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| [items] | Array of PermissionDto objects | Definition Resource permission list. |
| Parameter | Type | Description |
|---|---|---|
| order | Integer | Definition Order ID. Value range: 1~2147483647 |
| role_id | String | Definition Role ID. Range 1–1,000 characters. |
| role_name | String | Definition Role name. Range 1–1,000 characters. |
| role_name_cn | String | Definition Role name in Chinese. Range 1–1,000 characters. |
| resource_permissions | PermissionMap object | Definition Resource permission mapping. |
| Parameter | Type | Description |
|---|---|---|
| {User defined key} | Map<String,ResourcePermissionDto> | Definition Resource permission object. |
| Parameter | Type | Description |
|---|---|---|
| permission_id | Integer | Definition Record ID. Value range: 1~2147483647 |
| action | String | Definition Operation. Range 1–1,000 characters. |
| display_name | String | Definition Operation name. Range 1–1,000 characters. |
| display_name_cn | String | Definition Operation name in Chinese. Range 1–1,000 characters. |
| enabled | Boolean | Definition Whether to enable. |
| editable | Boolean | Definition Whether to edit. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Example Requests
GET https://{endpoint}/v4/groups/{group_id}/permissions-resources/{resource_id}?offset=0&limit=20 Example Responses
Status code: 200
Obtain roles and permissions corresponding to resource points.
[ {
"order" : 1,
"role_id" : "d4b6fd9af7e34b168de2fef683058f13",
"role_name" : "Project manager",
"role_name_cn" : "Project manager",
"resource_permissions" : {
"fork" : {
"permission_id" : 2,
"action" : "fork",
"display_name" : "fork",
"display_name_cn" : "fork",
"enabled" : true,
"editable" : true
},
"create" : {
"permission_id" : 1,
"action" : "create",
"display_name" : "create",
"display_name_cn" : "Create",
"enabled" : true,
"editable" : true
},
"delete" : {
"permission_id" : 3,
"action" : "delete",
"display_name" : "delete",
"display_name_cn" : "Delete",
"enabled" : true,
"editable" : true
},
"setting" : {
"permission_id" : 30,
"action" : "setting",
"display_name" : "setting",
"display_name_cn" : "Setting",
"enabled" : true,
"editable" : true
}
}
} ] Status code: 401
Unauthorized
{
"error_code" : "DEV.00000003",
"error_msg" : "Authentication information expired."
} Status code: 403
Bad Request
{
"error_code" : "CH.004403",
"error_msg" : "Insufficient permissions. Apply for the required permissions and try again."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Obtain roles and permissions corresponding to resource points. |
| 401 | Unauthorized |
| 403 | Bad Request |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.