英文:
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
是的,这是可能的。
-
首先,您需要从您的PBI Service中的数据集生成一个用于创建报告的嵌入令牌。可以通过在后端发出POST请求来完成。
-
然后,您可以从该数据集创建一个新报告(在前端使用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);
参考资料:
英文:
Yes, it is possible.
-
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.
-
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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论