How to connect Power BI with secure APIs (Token)
This was a challenge for me because I didn't know how I could connect these tools in a secure & automated way. And then, we have it: an automated dashboard that brings us all the information we need.
First, you will need a Windows environment to install Power BI. It could be your computer or a remote server.
With the tool installed, click on Get data and then on Web, as in the image below.
In this pop-up, paste the API URL, and write your encrypted token in your parameters. You can use any free tool to encode your token. I used this one.
The pop-up is going to be like this one:
Click at Transform data to open Power Query Editor.
At the Advanced Editor, we have our DAX code. Yours needs to be something like this:
let
Fonte = Json.Document(Web.Contents("https://yourapiurl.com", [Headers=[Authorization="Basic YourBearerTokenEncrypted= "]])),
in
Fonte
That's it! Your dashboard is now ready: connected and updated with your API.