Query Permission Data of Project

Last Updated on : 2023-10-09 08:06:54download

Based on the permission name, fuzzy query the permission data under the current project.

API address

GET: /v2.0/cloud/iam/permission/query

Request parameter

Parameter nameTypeINRequiredDescription
permission_nameStringquerytrueThe name of the specified permission.
last_row_keyLongqueryfalseThe starting ID of the query.
page_sizeIntegerqueryfalseThe number of items returned on each page.

Return parameter

Parameter nameTypeDescription
successBooleanIndicates whether the operation is successful. Valid values:
  • true: The operation succeeded.
  • false: The operation failed.
error_codeStringThe error code. For more information, see the error codes.
error_msgStringThe message that is returned if the request fails. It is empty if the request is successful.
resultQueryPermissionByLikeNameResThe returned result.

Description of result

Parameter nameTypeDescription
permission_and_permission_item_listListThe list of permissions.
last_row_keyLongThe starting ID of the query.
page_sizeIntegerThe number of items returned on each page.
totalIntegerThe total number of returned entries.

Description of permission_and_permission_item_list

Parameter nameTypeDescription
permission_idLongThe ID of the specified permission.
nameStringThe name of the specified permission.
descriptionStringThe description of the specified permission.
permission_item_listListThe list of sub-permissions.
gmt_createLongThe creation time.

Description of permission_item_list

Parameter nameTypeDescription
item_idLongThe ID of the specified sub-permission.
policy_idLongThe ID of the specified policy.
policy_nameStringThe name of the specified policy.
resource_idStringThe ID of the specified resource.
resource_typeIntegerThe type of the specified resource. Valid values:
  • 1: space resource.
  • 2: device resource.
  • 11: global resource type.
item_typeIntegerThe type of the specified sub-permission. Valid values:
  • 1: The space contains subgroups.
  • 0: The space does not contain subgroups.

Request example

GET: /v2.0/cloud/iam/permission/query?permission_name=name1&lastRowKey=0&pageSize=100

Return example

{
    "tid": "195bceee56b411ee801ef25dabf95fef",
    "result": {
        "last_row_key": 181044,
        "permission_and_permission_item_list": [
            {
                "gmt_create": 1695104201,
                "permission_item_list": [
                    {
                        "policy_id": 110001,
                        "item_id": 232371810,
                        "item_type": 0,
                        "resource_type": 11,
                        "resource_id": "*"
                    }
                ],
                "description": "Description",
                "permission_id": 232371810,
                "name": "Permission name"
            }
        ],
        "total": 15,
        "page_size": 10
    },
    "t": 1695104201504,
    "success": true
}

Error code

For more information, see error code.