简体   繁体   中英

How to embed Power BI Q&A?

I'm embedding the Microsoft Power BI Q&A but getting error on console below are the attached screenshot for embed configuration and error.

embed configuration and error

在此处输入图片说明

I followed the https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html# link for embedding the Q&A but getting error.

tokenType = 1 in your config suggests EmbedToken which is generated via /GenerateToken API call. try either changing tokenType to 0 (TokenType.Aad) or retrieving this token using: https://msdn.microsoft.com/en-us/library/mt784614.aspx

or this tutorial: https://guyinacube.com/2017/09/get-embed-token-power-bi-dashboards-reports/

After a lot of analysis, I found the answer.

Body:- { "accessLevel": "view" }

Response:- { "@odata.context":"http://api.powerbi.com/v1.0/myorg/groups/your_group_id/$met...GenerateTokenResponse", "token":"H4sI........A=", "tokenId":"951b6385-d004-42e4-84a1-e45d904bfca0", "expiration":"2018-05-10T08:08:33Z" }

Embed Configuration:-

       var embedUrl = 'https://app.powerbi.com/qnaEmbed?groupId=your_group_id';
       var config = {
                    type : 'qna',
                    tokenType : models.TokenType.Embed,
                    accessToken :  token, // from the above api call
                    embedUrl: ,
                    datasetIds: datasetIds,
                    viewMode : 0, // 0 = Interactive , 1 = readonly
                    question: your_question
                };`
  • Get the reference of html element where you want to embed Q&A chart. var qnaContainer = $('#qnaContainer');

  • Embed the QNA and display it within the div container

var qna = powerbi.embed(qnaContainer, config);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM