任何在Power BI服务中创建报告的REST API吗?

huangapple go评论57阅读模式
英文:

any Rest APIs to create a report in powerbi service?

问题

I have searched official Power BI documentation thoroughly. There are APIs for creating datasets, updating them, and for deleting them. Additionally, there are APIs to clone, update, and delete a report.

But after searching a lot, I have not been able to find anything that can help me in the creation of a fresh new (visual) report through API?

PS: actually I want to create a visual (not paginated) report without manually going to Power BI Desktop or service. I just want to do it with the help of a Power BI REST API.

So is there any way we can create a new report from an existing dataset with a REST API?

Also, if not possible with REST APIs, could this maybe be possible with Power BI Embedding?

英文:

i have searched official powerbi docs thoroughly.

There are APIs for creating datasets, updating them and for deleting them.
Additionally, there are APIs to clone, update and delete a report.

But after searching a lot, I have not been able to find anything that can help me in creation of a fresh new (visual) report through API?

PS: actually I want to create a visual (not paginated) report without manually going to powerbi desktop or service. I just want to do it with the help of a powerbi rest API.

So is there anyway we can create a new report from existing dataset w/ rest API?

Also, if not possible with rest apis, could this may be possible with powerbi-embedding?

答案1

得分: 2

是的,这是可能的。

  1. 首先,您需要从您的PBI Service中的数据集生成一个用于创建报告的嵌入令牌。可以通过在后端发出POST请求来完成。

  2. 然后,您可以从该数据集创建一个新报告(在前端使用createReport方法)。

示例:

let embedCreateConfiguration = {
    tokenType: tokenType,
    accessToken: accessToken,
    embedUrl: embedURL,
    datasetId: datasetId,
    settings: settings, // 可选
    theme: theme, // 可选
};

// 获取托管报告的 div HTML 元素的引用
let embedContainer = $('#embedContainer')[0];

// 创建报告
let report = powerbi.createReport(embedContainer, embedCreateConfiguration);

参考资料:

  1. 创建、编辑和保存嵌入式报告 | Microsoft Learn

  2. 嵌入令牌 - 生成用于创建组中报告的REST API(Power BI Power BI REST APIs)| Microsoft Learn

英文:

Yes, it is possible.

  1. First, you need to generate an embed token for report creation from a dataset present in your PBI Service. It can be done by making a POST request to the API from backend.

  2. After that, you can create a new report from that dataset. (Using createReport method in your frontend)

example:

let embedCreateConfiguration = {
    tokenType: tokenType,
    accessToken: accessToken,
    embedUrl: embedURL,
    datasetId: datasetId,
    settings: settings, //optional
    theme: theme, // optional
};

// Grab the reference to the div HTML element that will host the report
let embedContainer = $('#embedContainer')[0];

// Create report
let report = powerbi.createReport(embedContainer, embedCreateConfiguration);

References:

  1. Create, edit, and save an embedded report | Microsoft Learn

  2. Embed Token - Reports GenerateTokenForCreateInGroup - REST API (Power BI Power BI REST APIs) | Microsoft Learn

huangapple
  • 本文由 发表于 2023年2月6日 13:19:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357573.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定