Embed Server Reports

Embed Server Reports provides option to render the Reports into other web applications. Follow the below steps to embed server Reports into other web applications.

Getting Embed URL

  1. Click the Actions button in the Reports grid context menu and select Get Embed code of the corresponding Reports to embed.

    Embed code

  2. By Default, Saved Views and Comments are enabled. You can able to disable the Saved Views or Comments by sliding the Saved Views or Comments button as below.

    Disabled Comment

  3. Copy the embed URL by clicking the copy icon from the Get Embed code dialog.

    Embed URL

Embed using Server Authentication

Embed the copied URL into other web application with the help of the following code snippet.

  • HTML
  • <html>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    
    <body>
        <iframe id="frame-div" width="100%" height="100%" frameborder="0" src="http://localhost:53002/reports/embed/Sample%20Reports/Product%20Line%20Sales?hascomments=true&hasviews=true&hassso=false" onload="apiCall()"></iframe>
    
        <script>
            $(document).ready(function() {
                jQuery.support.cors = true;
            });
    
            function apiCall() {
                var dataValue = "";
                var element = document.getElementById("frame-div").contentWindow;
                var apiRequest = new Object();
                var baseURL = "http://localhost:53002"; //Replace here with the launched Report Server site URL
                apiRequest.validationKey = ""; //Find the Validation key in MachineKey node of the Report Server web.config file
                apiRequest.decryptionKey = ""; //Find the Decryption key in MachineKey node of the Report Server web.config file
                apiRequest.userId = "admin"; //Username/UserId of the user who has permission to the particular Report
                apiRequest.password = "admin"; //Password of the user. Its optional when validationKey and decryptionKey is used.
                $.ajax({
                    type: "POST",
                    url: baseURL + "/api/get-user-key",
                    data: apiRequest,
                    success: function(data) {
                        dataValue = data.Token;
                        element.postMessage(dataValue, "*");
                    },
                    error: function(data) {
                        element.postMessage("", "*");
                    }
                });
            }
        </script>
    
    </html>

    Please find the below changes that have to be done to render the Report into the web application.

    1. Paste the copied Embed URL instead of the above iframe.
    2. Add the apiCall() function invoke in iframe onLoad event.
    3. Can able to get the token using either by passing the below three type of properties.
      a. Username and Password
      b. UserId, ValidationKey and DecryptionKey
      c. Username, ValidationKey and DecryptionKey

    NOTE

    Public Reports does not need token to authenticate with Report Server.

    Embed using Windows AD Authentication

    If the Report Server deployed into the machine which has configured with the Windows Active Directory, then follow the below steps to get the embed code with the Windows Active Directory SSO settings.

    1. Click the Actions button in the Reports grid context menu Get Embed code and enable SSO and select Windows Active Directory as shown below.

      Use SSO

    2. Paste the embed URL into an web application which has Windows Active Directory configuration.

    3. Run the web application and the Reports will render automatically.

    Embed using Azure AD Authentication

    If the Report Server deployed into the machine which has configured with the Azure Active Directory, you can follow the below steps to get the embed code with the Azure Active Directory SSO settings.

    1. Copy the embed URL from the Reports context menu Get Embed code and enable SSO and select Azure Active Directory as shown below.

      Use SSO AzureAD

    2. Paste the embed URL into an web application which has Azure Active Directory configuration.

    3. Run the web application and the Reports will render automatically.