Show report on your system
Atualizado
Atualizado
The first step is to get the API key from the settings screen to authenticate:
With this key, you can now authenticate requests using the API.
To return the URL that you will use to access the reporting portal transparently, without going through the login screen, use the POST call below:
The X-API-Key header must be entered, passing as its value the API token generated above by the settings screen.
The body of the request has the following possible values:
userEmail: The only mandatory field in the request. The email address of the person who is logged into your system must be entered. This user will be recorded in the audits and the reports that this user has access to will be shown on the screen. If the report has an RLS, it will be applied automatically, using the filtering rules for the user provided.
baseUrl: In this field, you must fill in the information about the configured subdomain. It is mandatory to enter this data so that the entire experience is personalized, including in the event of token expiry.
When the organizationId and reportId parameters are NOT entered, the complete viewing portal will be rendered in your system, just as when you access it in traditional mode (without API), showing only the reports that the user entered has access to. The user will be free to browse the reports they have access to.
hideMenu: Hides the menu bar when the report is opened.
hideNavbar: Hide the navigation bar when the report is opened
hideSidebar: Hide the sidebar on the navigation screen.
embed: This is a shortcut parameter that can be used to set all the above display properties at once.
If you want to display a specific report, you must enter the following 2 parameters:
organizationId: This is the unique ID of your organization in the system. This ID is fixed and is never changed. You can obtain this ID from the URL on the “Settings” screen
reportId: This is the report ID, where each report has its own unique ID (it is the same as the reportId of the report in the Power BI service). To get the report ID, capture the ID from the URL on the report editing screen:
The API callback is a URL that can only be accessed once and if you don't access it, it will expire in 5 minutes:
If you have entered the other parameters, such as organizationId and reportId (to show only 1 report) and the display parameters, the request will have this format:
And the URL returned will be something like this:
With this URL generated, you just need to create an iframe using it like the example below:
And with that, you can now show Power BI reports in your application, through Power Embedded, transparently and securely.
As the URL token is for SINGLE use, this URL can only be accessed once. If you want to show the report again, you'll have to execute this request again.
As the token is for the specific user, when accessing a report, Power Embedded knows who the user is accessing and validates whether that user has access to the report being shown and applies the RLS rules if the report does.
To be able to generate the access token and render the reports in your application, you must first obtain the token using the call below:
And the server will return the SINGLE-USE token to call the API's (each request must ask for a new token):
Now we can call the API that renders the report, giving it parameters:
The base URL of the viewing portal (Ex: https://relatorios.powerembedded.com.br - Here you use your custom domain, such as https://bi.suaempresa.com.br/, for example)
The token generated in the previous step (Ex: 2506b719-5a7e-789b-812f-c64013cc617f)
The organization ID (fixed ID for Power Embedded customers - it's in the URL of the settings screen - Ex: 12201800-1a46-491a-bfe3-6ee5590e372e)
The ID of the report to be embedded (Ex: a4ee7a1e-6c65-44e7-9a38-06dd8514483c)
This will open an iframe with the following URL: https://bi.suaempresa.com.br/integration/tokenauth?token={token_gerado}&embed=true&returnUrl=/Organization/{Id_da_Organizacao}/Report/{Id_Relatorio}
Example with the variables filled in: https://bi.suaempresa.com.br/integration/tokenauth?token=98b6e796-3b1f-4f2f-abfe-aa2a8a1eadb8&embed=true&returnUrl=/Organization/12201800-1a46-491a-bfe3-6ee5590e372e/Report/a4ee7a1e-6c65-44e7-9a38-06dd8514483c
As the token is for SINGLE use, this URL can only be accessed once.
If you want to embed the report again, you will have to generate a new access token for the e-mail address provided.
As the token is for the specific user, when accessing a report, Power Embedded knows who the user is accessing and validates whether that user has access to the report being embedded and applies the RLS rules, if the report does.
Complete API documentation: Swagger UI (powerembedded.com.br)
API demo page for Embedding reports: Demo – PowerPortal.IntegrationDemo (powerembedded.com.br)