Query Roles with Target Data Source Permissions
Use this API to list roles that have a specified permission on a target data source. Use it to audit which roles can perform a particular operation on a data source.
Request URL: /openapi/v1/role/datasource/list
Request Method: GET
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| datasourceId | String | Yes | Data source ID. | ds-abc123 |
| action | String | Yes | Permission name. Options:
| Readonly |
| current | Integer | No | Current page number. | 1 |
| pageSize | Integer | No | Page size. | 10 |
Response Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | Whether the request was successful. | true |
| requestId | String | Request ID. | Mi6y0FCN-BHEEaHAnCFFp9DFdAAk0OUZ |
| data | Array | Role list. Each role includes these fields:
| { "roleId": "16", "name": "System Administrator", "type": "system" }, { "roleId": "40", "name": "Production Environment Administrator", "type": "custom" } |
| current | Integer | Current page number. | 1 |
| pageSize | Integer | Page size. | 10 |
| total | Integer | Total number of records. | 2 |
Successful Invocation Example
{
"success": true,
"requestId": "Fg1p1HNO-cigfjUOnhfdn3ZOddjy1CAI",
"data": [{
"roleId": "16",
"name": "System Administrator",
"type": "system"
}, {
"roleId": "40",
"name": "Production Environment Administrator",
"type": "custom"
}],
"current": 1,
"pageSize": 10,
"total": 2
}
Result
A successful response returns roles that match the data source and permission filter. Use the returned roleId to inspect or update role configuration.