3

I want to embed Power BI non-group workspace report in my application i.e., the reports that I have created or are shared with me and are not published to any workspace. I gone through the articles for embedding the report but didn't find any matching my scenario.

For embedding report, we need Embedded Token, for this I'm making a POST request to Power BI Rest API with the URL

https://api.powerbi.com/v1.0/myorg/reports/{reportId}/GenerateToken

Using the above request, I'm getting the response code 403 and error {"error":{"code":"InvalidRequest","message":"Embedding isn't supported for non-group workspace"}}.

Is there any way to generate embed token for reports or dashboards that are not in any workspace.

1 Answers1

2

I ran into the same issue. Seems however you will need to place the report into a workspace. Whether manually or by cloning.

It is odd to expose an endpoint that does not work to generate a token for a report, but the documentation does specifically say:

This functionality is only available in a workspace context. Use Reports GenerateTokenInGroup.

NOTE: With regards to cloning, although not stated clearly in the documentation it seems if you clone to a different workspace (targetWorkspaceId in request) you also need to provide the target dataset (targetModelId in request). If you don't have a dataset to use an alternative to cloning would be to Export the report and then to Import it which will create a dataset

  • I'm unable to clone the report to the specified workspace. I'm passing 2 fields in the POST message body (name and targetWorkspaceId). Its giving me an error code of 400. @Riaan Crause – Harshvardhan Chittora Nov 15 '18 at 08:14
  • @HarshvardhanChittora I encountered the same problem before. Although the documentation does not specifically state it. It would seem that if you include targetWorkspaceId in your request you also need to provide a targetModelId. If there is no dataset in your target workspace I have found that you can the the following: 1. [Export](https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exportreportingroup) the report 2. [Import](https://docs.microsoft.com/en-us/rest/api/power-bi/imports/postimportingroup) the report (This will create a dataset). I'll update my answer with this info – Riaan Crause Nov 23 '18 at 06:53
  • It's not as straightforward as it seems. For exporting, I need to create a separate group with some set of permissions and then export and import the report/ dashboard and then need to delete the created group as it will be no longer required. Did you find any other alternative to achieve same/ @Riaan Crause – Harshvardhan Chittora Nov 23 '18 at 09:02
  • @HarshvardhanChittora I'm afraid I have not found another alternative, but if I happen to stumble across one I'll share it with you. – Riaan Crause Nov 23 '18 at 09:29