How to Retrieve Dashboard Lists Based on User via REST API?
Overview
In Bold BI, it is possible to retrieve dashboard lists specific to individual users through the API. This allows for a more tailored experience, ensuring that users only see the dashboards they have access to.
Use Case
Consider a scenario where there are two users: User1 has access to 10 dashboards, while User2 has access to 5 dashboards. By utilizing the API, one can retrieve the number of dashboards associated with a specific user without fetching the entire dashboard list.
Steps to Retrieve User-Specific Dashboard Lists
Step 1: Generate Access Token
To begin, you need to generate an access token for the user whose dashboard list you want to retrieve. Use the following API request:
API Request URL:
https://{yourdomain}/bi/api/site/site1/token
Request Body:
{
"username": "user1@gmail.com",
"embed_secret": "<:embedSecret of the site>",
"grant_type": "embed_secret"
}
Response:
{
"access_token": "string",
"token_type": "string",
"expires_in": "string",
"Email": "string"
}
For more details, refer to the API Documentation.
Step 2: Retrieve the Dashboard List
Once you have the access token, you can retrieve the dashboard list for the specific user. Include the access token in the authorization header of the following API request:
API URL:
https://{yourdomain}/bi/api/site/<site_identifier>/v5.0/dashboards
Authorization : Bearer <:access_token>
Response:
{
"Data": [],
"TotalResults": 0,
"Links": [
{}
]
}
In the response, the Data
field will contain the dashboards associated with the user. For example, it will show 10 dashboards for User1 and 5 dashboards for User2.
For further information, see the Get Dashboards API Documentation.