How to utilize the embed token in the Embedded reporting
Bold Reports provides REST APIs that allow programmatic access and management of various reporting resources. These APIs enable developers to automate tasks and integrate report functionalities within applications.
To efficiently generate an embed token from the Bold Reports API, you can use Postman, a popular API client. This guide outlines the steps to retrieve report details based on a specific category name.
Steps to Generate the Embed Token
-
Open the
Postmanapplication and create a newPOSTHTTP request. -
Follow the instructions to generate an embed token for the Bold Reports Server using the API.
-
The request URL should follow this format, where you need to replace placeholders with actual values:
{BoldReportsUrl}/reporting/api/site/{{tenant-name}}/token
Note: Replace {BoldReportsUrl} with the base URL of your Bold Reports server, <tenant-name> with your actual tenant name.
- The request body should include the following mandatory fields:
grant_type,ReportServerUser, andPassword. Additionally, you can configure custom attributes and report parameters for the report by adding them in the request body.
{
"grant_type": "embed_token",
"ReportServerUser": "string",
"Password": "string",
"ExpiresIn": "123",
"ReportParameters": [{
"Key": "string",
"Values": [
"string1",
"string2"
]
}
],
"CustomAttributes": [
{
"Key": "string",
"Value": "string"
},
{
"Key": "string",
"Value": "string"
}
]
}
- You will receive a response containing the embed token under the
access_tokentag:
Using the token in Bold Reports Viewer
After generating the token with the customized parameter and custom attributes, you can use it to run the report with the respective parameters and custom attributes within the embedded application. Kindly add the embed token to the following API when initializing the viewer.
$("#report-viewer").boldReportViewer({
reportServiceUrl: "http://reportserver.syncfusion.com/ReportService/api/Viewer",
reportPath: report_path,
embedToken: generated_access_token
});