Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I´m doing a Power Bi report that use data from a API. I have done a table with the credentials to the API, username, password and subscriptionkey. The first question to all tables with data is to get the token from the API so I can ask the question correct. Looks like this in my table and the advanced editor:
"
Url = Text.Format("https://api.hey.com/fun/authentication/login?username=#{0}&password=#{1}",{#"UserIdFile", Uri.EscapeDataString(#"PasswordFile")}),
TokenSource = Json.Document(Web.Contents(Url, [Headers=[#"Ocp-Apim-Subscription-Key"=SubscriptionKey]])),
userCode = TokenSource[userCode],
Ask = Text.Format("https://api.hey.com/fun/v1/machines/#{0}/history/utilization?start=#{1}&end=#{2}&expand=1", {#"MachineId", #"startDate", #"endDate"}),
Source = Json.Document(Web.Contents(Ask, [Headers=[#"X-Auth-Token"=userCode, #"Ocp-Apim-Subscription-Key"=SubscriptionKey]])),
"
My table with the credentials looks like this:
One row with my username, password and sub key.
When I refresh the reports everything works fine and I get new data.
But now the tricky part starts 🙂
My user of this reports when I publish them need to be able to update the credentials with their own ones.
How do I solve that?
I have looked into using PowerApps with edit forms and other ways. I´m not a super user of PowerBi and PowerApps so maybe I have done something wrong....
@ekstrem This can only be done using Power Query extension (and thus creating a custom connector for the API).
https://docs.microsoft.com/en-us/power-query/handlingauthentication
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |