Category / Section
How to Grant Data Source Permissions with Bold BI REST API
Published:
This article will explain about granting permissions for data sources using the REST API in Bold BI. This can be achieved by providing permission to the user or to any of the groups where the user exists.
Authentication
When you sign into Bold BI, an authentication token is provided that should be attached in the request header (Authorization) for all subsequent API calls to authenticate the requests. To get the authorized token, refer to the document How to generate access token to authenticate users | Bold BI Docs
API Endpoint
To provide permission for the data sources, use the following API endpoint:
Method | Endpoint | |
---|---|---|
User Permission |
POST |
/v5.0/permissions/users |
Group Permission |
/v5.0/permissions/groups |
Embedded Bold BI: {domain_name}/bi/api/site/{site_identifier}/v5.0/permissions/users
Cloud Bold BI: {domain_name}/bi/api/v5.0/permissions/users
Request Body
For User Permission API:
Name | Required | Type | Description |
---|---|---|---|
PermissionAccess | Yes | String | Specify an access type for item. Values allowed are,
|
UserId | Yes | Int | User ID to whom the permission needs to be provided. To get user ID use the API Get Specific User Detail. |
PermissionEntity | Yes | String | Specify an entity of item for permission. Values allowed are,
|
ItemId | No | Guid | Specify the data source ID while assigning permission to particular item. To get the data source use the API Get Data Source Details by filtering the specific data source using its name in the query parameter q. This ID needs to be provided when PermissionEntity has the value SpecificDataSource. |
For Group Permission API:
Name | Required | Type | Description |
---|---|---|---|
PermissionAccess | Yes | String | Specify an access type for item. Values allowed are,
|
GroupId | Yes | Int | Group ID to where permission needs to be provided. To get group ID use the API Get Groups Detail by filtering the specific group using its name in the query parameter q. |
PermissionEntity | Yes | String | Specify an entity of item for permission. Values allowed are,
|
ItemId | No | Guid | Specify the data source ID while assigning permission to particular item. To get the data source use the API Get Data Source Details by filtering the specific data source using its name in the query parameter q. This ID needs to be provided when PermissionEntity has the value SpecificDataSource. |
Step-by-Step Guide:
- AllDatasources Permission Entity:
The AllDatasources permission entity enables you to provide access to all data sources of the tenant site. - SpecificDataSource Permission Entity:The SpecificDataSource permission entity allows you to grant access to a particular data source of the tenant site.
- Request and Response:
When sending API requests to grant data source permissions, you need to structure the necessary information in the request body. Correspondingly, the API will respond with feedback on the success or failure of the permission update.
Sample Request Body:
{
"PermissionAccess": "Create", // or "Read" or "ReadWrite" or "ReadWriteDelete"
"UserId": "user_id_here",
"PermissionEntity": "AllDatasources", // or "SpecificDataSource"
"ItemId": "data_source_id_here" // Only required for SpecificDataSource permission entity.
}
Sample Response:
{
"ApiStatus": true,
"Status": true,
"StatusMessage": "User Permission has been added successfully"
}