List¶
GET /api/v1/role/list
Overview¶
List the roles in the target workspace with pagination.
Prerequisites and Steps¶
Call this API with the API Key of the target workspace. The list includes system built-in roles applicable to the workspace, management backend built-in roles, and workspace custom roles. To find a specific role, filter by name and use the uuid as the stable identifier.
Select the OpenAPI address of the site from the Site Domain Table.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI Key credential of the workspace. Use the full key value, not the UUID of the API Key record. Example: <DF-API-KEY>How to obtain or fill in: Create or obtain a Key with permission for this API in API Key Management of the target workspace. |
Query Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| search | string | Fuzzy match by name; if omitted or blank, no filtering by name is applied. null allowed: False Example: 只读How to obtain or fill in: Use the role name or part of it as shown on the Role Management page in the console. |
|
| statMember | boolean | Member counts are calculated and memberCount is added to each role only when lowercase true is passed. Not calculated by default. null allowed: False Example: trueHow to obtain or fill in: Set the URL query parameter statMember=true when you need to display the number of role members. |
|
| pageSize | integer | Number of records per page, default 100. Pass a positive integer. null allowed: False Example: 100How to obtain or fill in: Enter an integer according to the page capacity the client requires. |
|
| pageIndex | integer | Page number, default 1. null allowed: False Example: 1How to obtain or fill in: Increment page by page starting from 1, and verify with the returned page number. |
Additional Notes on Parameters¶
The workspace is determined by the DF-API-KEY in the request.
Request Example¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
"https://openapi.guance.com/api/v1/role/list" \
--data-urlencode "search=只读" \
--data-urlencode "statMember=true" \
--data-urlencode "pageIndex=1"
Response¶
HTTP 200, application/json.
| Field | Type | Description |
|---|---|---|
| content.data | array<object> |
Results on this page; an empty array when there are no records. |
| content.data[].id | integer | Role record ID. |
| content.data[].uuid | string | Role UUID; use this field for subsequent queries of role details. |
| content.data[].name | string | Role name. |
| content.data[].desc | string | Role description. |
| content.data[].isSystem | integer | 1 indicates a system built-in role; 0 indicates another role. |
| content.data[].workspaceUUID | string | The workspace the role belongs to or applies to; can be empty for system built-in roles. |
| content.data[].builtinRoleUUID | string | UUID of the management backend built-in role template; empty when there is no template. |
| content.data[].isAllWorkspace | integer | Whether the management backend built-in role applies to all workspaces: 0 = no, 1 = yes. |
| content.data[].isManageBuiltinRole | boolean | Whether this is a built-in role defined and applied through the management backend. |
| content.data[].creator | string | Creator identifier. |
| content.data[].updator | string | Last updater identifier. |
| content.data[].createAt | integer | Creation time in Unix seconds. |
| content.data[].updateAt | integer | Last update time in Unix seconds. |
| content.data[].deleteAt | integer | Deletion time in Unix seconds; -1 when not deleted. |
| content.data[].status | integer | Status of the role record. |
| content.data[].creatorInfo | object | Creator profile; {} when not found. |
| content.data[].updatorInfo | object | Last updater profile; {} when not found. |
| content.data[].memberCount | integer | Returned only when statMember=true. Deduplicated by member, including members who obtain the role directly and through groups. |
| pageInfo | object | Pagination information. |
| pageInfo.pageIndex | integer | Current page number, starting from 1. |
| pageInfo.pageSize | integer | Number of records per page. |
| pageInfo.count | integer | Number of records returned on the current page. |
| pageInfo.totalCount | integer | Total number of roles matching the conditions; still usable to calculate the total number of pages when the current page has no records. |
| content.declaration | object or null | Public declaration data of the workspace; can be null when the configuration is empty. |
{
"code": 200,
"content": {
"data": [
{
"id": 101,
"uuid": "role_example",
"name": "日志只读",
"desc": "查询应用日志",
"isSystem": 0,
"workspaceUUID": "wksp_example",
"builtinRoleUUID": "",
"isAllWorkspace": 0,
"isManageBuiltinRole": false,
"status": 0,
"creatorInfo": {},
"updatorInfo": {},
"memberCount": 2
}
],
"declaration": null
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE",
"pageInfo": {
"pageIndex": 1,
"pageSize": 100,
"count": 1,
"totalCount": 1
}
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | An undeclared Query parameter is passed | The message indicates the invalid parameter. | Remove fields not listed in the parameter table. |