Forum Discussion

ys01's avatar
ys01
Frequent Visitor
2 years ago
Solved

How to create a blank embedded paginated report using the powerbi-client library as master user

Hello! I'm using the powerbi-client library to create a new report in an container. I am able to use the createReport method to create reports but not paginated reports. This is the code I'm using to create reports: 

import * as pbi from "powerbi-client";
const
powerbi = new pbi.service.Service(
            pbi.factories.hpmFactory,
            pbi.factories.wpmpFactory,
            pbi.factories.routerFactory
        );
        let embedCreateConfiguration = {
            tokenType: 1,
            accessToken: "<access_token>",
            embedUrl: "https://app.powerbi.com/reportEmbed",
            datasetId: "<dataset_id>",
        };
        let embedContainer = document.getElementById("embed");
        let report = powerbi.createReport(
           embedContainer,
            embedCreateConfiguration
        );
My idea to create paginated reports was to change the embed url to "https://app.powerbi.com/rdlEmbed". When I do that I get an infinte spinner animation and no report is being created. 
 
I'm generating an access token by passing this request body in:
{"datasets": [{"id": "<dataset_id>"}, "targetWorkspaces": [{"id": "<workspace_id>"}]]
Is this soley because I'm using a master user to authenticate? Or is this due to some malformed configuration that I'm passing into the library? Thanks in advance!
  • Hi ys01  

    here is a sample attempt i made to connect to JS script. 

    var embedConfiguration = {
    type: 'report',
    accessToken: '<embed_token>',
    embedUrl: '<report_url>',
    tokenType: models.TokenType.Embed,
    settings: {
    filterPaneEnabled: false,
    navContentPaneEnabled: false
    }
    };

    var reportContainer = document.getElementById('reportContainer');

    var report = powerbi.embed(reportContainer, embedConfiguration);

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

1 Reply

  • Hi ys01  

    here is a sample attempt i made to connect to JS script. 

    var embedConfiguration = {
    type: 'report',
    accessToken: '<embed_token>',
    embedUrl: '<report_url>',
    tokenType: models.TokenType.Embed,
    settings: {
    filterPaneEnabled: false,
    navContentPaneEnabled: false
    }
    };

    var reportContainer = document.getElementById('reportContainer');

    var report = powerbi.embed(reportContainer, embedConfiguration);

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!