Forum Discussion

lherbert501's avatar
lherbert501
Post Prodigy
1 year ago
Solved

Embed API Sample error

Hi,

 

I'm trying to create a test embedded location and tried running the sample app from  Guy in a Cube.

 

I'm having a few problems and get this error when I try to run it. Does anybody know what that means?

 

Thanks in advance

 

 

Could somebody also kindly advise which username and role goes in below?

 

 

 

 

Code below

 

Thanks

 

guyinacube/Embed-API-Sample: A sample application to use the Power BI APIs for embedding. This makes use of the Power BI .NET SDK which in turn calls the Power BI REST API. (github.com)

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi lherbert501 ,

    I tried to fix it myself, but it seems that this is because some of the content in the predefined configuration file before the code is outdated. If you want to modify it, you may not only need to modify the content in the screenshot, but also go back here to modify it:

    I'm not sure how the original author defined it, but I saw that this document was published 4 years ago:


    So it's very likely that some of the content is outdated. I think the best way is to find the original author and ask him to update it.

    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi lherbert501 ,

    About the first question, have you created a data source connection using one of the gateways to the semantic model of the report you need to embed? And have you change contents here?

     

    And about the second question, based on the screenshot you provided, it looks like you are trying to embed a report with RLS applied. So for the parameter Role, fill in the name of the RLS you created:

    As for the parameter username, it depends on whether you are implementing a static RLS or a dynamic RLS.
    If it is a static RLS, then you can give it any string:

    But in the case of a dynamic RLS, the role of username is to pass a parameter value to your previously defined RLS role, so here you need to give username a specific string, i.e., what you want your RLS to be equal to.
    You can refer to the following two documents, which explain it in more detail:
    https://learn.microsoft.com/en-us/power-bi/developer/embedded/cloud-rls 
    https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token#example-of-generating-an-embed-token-for-two-datasets-with-rls-identities-and-a-single-report-with-read-only-permissions.-the-embed-token-lets-you-view-the-report,-which-is-dynamically-bound-to-two-different-datasets. 

    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • lherbert501's avatar
      lherbert501
      Post Prodigy

      Hi Anonymous ,

       

      Thankyou for your reply.

       

      Could you please help me with the gateway aspect, as I think its the only thing left that's preventing it.

       

      I have the gateway connection set up for the report that works fine and refreshes fine as below. Which bit do I change in the code?

       

       

      I was unsure if the code below needed to stay commented out

       

       

       

      Thanks

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi lherbert501 ,

        I tried to fix it myself, but it seems that this is because some of the content in the predefined configuration file before the code is outdated. If you want to modify it, you may not only need to modify the content in the screenshot, but also go back here to modify it:

        I'm not sure how the original author defined it, but I saw that this document was published 4 years ago:


        So it's very likely that some of the content is outdated. I think the best way is to find the original author and ask him to update it.

        Best Regards,
        Dino Tao
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.