Articles in this section

Embed Bold Reports Report Server Reports in a Web Application

Published:
Updated:

To embed a report in a web application, point the Bold Reports Report Viewer at your Report Server’s built-in Web API. Set reportServiceUrl, reportServerUrl, serviceAuthorizationToken, and reportPath on the boldReportViewer widget. This works for both Enterprise (on-premises) and Cloud Report Server.

Applies to: Bold Reports Report Server — Enterprise (on-premises) and Cloud. JavaScript Report Viewer in a web application.

When to use this

Use this when you have a report already published to a Bold Reports Report Server and you want to display it inside your own web page. The Report Server exposes a built-in Web API, so you do not need to build your own reporting service.

Prerequisites

  • A report published to your Bold Reports Report Server (Enterprise or Cloud).
  • Permission to view that report.
  • A user access token generated from the Report Server. See the help topic “Generate an authentication token using the API”
  • A web page that references the Report Viewer stylesheet and scripts from the Bold Reports CDN, in this order:
    • bold.report-viewer.min.css
    • jquery.min.js
    • bold.reports.common.min.js
    • bold.reports.widgets.min.js
    • bold.report-viewer.min.js

Steps

First add a container element and initialize the viewer, then set four properties so the viewer can reach your server report. The service URL, server URL, and report path differ between the Enterprise and Cloud models, so follow the subsection that matches your Report Server.

Add a container element to your page:

<div id="viewer" style="height: 600px; width: 100%; min-height: 400px;"></div>

Embed a report from an Enterprise (on-premises) Report Server

  1. Generate a token with your user credentials and assign it to serviceAuthorizationToken, prefixed with "bearer ".
  2. Set reportServiceUrl to your Report Server’s built-in service URL, in the format https://your-server/reporting/reportservice/api/Viewer
  3. Set reportServerUrl to your Report Server’s built-in server URL, in the format https://your-server/reporting/api/site/your-site-name
  4. Set reportPath to the report location, in the format /category-name/report-name
  5. Save and run the page.

Initialize the viewer inside a jQuery ready block:

$(function () {
    $("#viewer").boldReportViewer({
        reportServiceUrl: "https://your-server/reporting/reportservice/api/Viewer",
        reportServerUrl: "https://your-server/reporting/api/site/your-site-name",
        serviceAuthorizationToken: "bearer your-access-token",
        reportPath: "/Sample Reports/Company Sales"
    });
});

Embed a report from a Cloud Report Server

  1. Generate a token with your user credentials and assign it to serviceAuthorizationToken, prefixed with "bearer ".
  2. Set reportServiceUrl to the Cloud service URL https://service.boldreports.com/api/Viewer
  3. Set reportServerUrl to your Cloud server URL, in the format https://your-tenant.boldreports.com/reporting/api
  4. Set reportPath to the report location, in the format /category-name/report-name
  5. Save and run the page.

Initialize the viewer inside a jQuery ready block:

$(function () {
    $("#viewer").boldReportViewer({
        reportServiceUrl: "https://service.boldreports.com/api/Viewer",
        reportServerUrl: "https://your-tenant.boldreports.com/reporting/api",
        serviceAuthorizationToken: "bearer your-access-token",
        reportPath: "/Sample Reports/Company Sales"
    });
});

Note: Generate the token on your server and pass it to the page at runtime. Do not hardcode a real token or server name in client-side code.

Result

The Report Viewer renders the selected server report inside the “viewer” container, with its toolbar for paging, printing, exporting, and report parameters.

Troubleshooting

The Report Viewer returns a 401 (unauthorized) response

The serviceAuthorizationToken is missing, malformed, or expired. Generate a fresh token, confirm the value starts with "bearer " followed by a space, and confirm the user has permission to view the report.

The report area is blank and the browser console shows a script error

The Report Viewer scripts and stylesheet are missing or loaded in the wrong order. Reference bold.report-viewer.min.css, jquery.min.js, bold.reports.common.min.js, bold.reports.widgets.min.js, and bold.report-viewer.min.js in that order before the initialization script.

The report fails to load with a “report path” error

The reportPath does not match a report on the server. Use the format /category-name/report-name and confirm the category and report names exactly match what is published on the Report Server.

Frequently asked questions

What is the difference between reportServiceUrl and reportServerUrl?

reportServiceUrl is the built-in Web API that processes and renders the report. reportServerUrl is the Report Server address the viewer uses to resolve the report and its resources.

How do I generate the serviceAuthorizationToken?

Send a POST request to https://your-server/reporting/api/site/your-tenant-name/token with username, password, and grant_type=password in the body. See the help topic “Generate an authentication token using the API”

Can I embed a report without exposing credentials in the browser?

Yes. Generate the token in your server-side code and pass only the token to the page. The Embed Secret Key API signs requests without sending a password from the browser.

Does this work for both on-premises and Cloud Report Server?

Yes. Only reportServiceUrl and reportServerUrl differ between the two models. The serviceAuthorizationToken and reportPath are set the same way.

What format should reportPath use?

Use /category-name/report-name, for example /Sample Reports/Company Sales

Related articles

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied