Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All
I have BMC Remedy API and trying to consume it to show data in dashboard.
I am followwing below vedio but no luck as I am not sure from where I can generate Bearer token. Also I am not sure there are different ways to consume on-premise API and cloud APIs .
https://www.youtube.com/watch?v=N8qYRSqRz84 ,
Please help me to understand how can I consume the api in Power BI.
Solved! Go to Solution.
Hi @Vinaysingh115 ,
Firstly, we need to get Access token in Power BI Desktop. We will get access token from Power BI by below code.
() =>
let
body = "client_id=" & #"App ID"
& "&scope=https://analysis.windows.net/powerbi/api/.default&client_secret=" & #"App Secret"
& "&grant_type=client_credentials",
Data= Json.Document(Web.Contents("https://login.microsoftonline.com/"& TenantID & "/oauth2/v2.0/token/",
[Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),
access_token = Data[access_token]
in
access_token
OR
() =>
let
body = "&grant_type=Password&resource = https://analysis.windows.net/powerbi/api
&client_id=*****&username=*****&password=*****",
Data=Json.Document(Web.Contents("https://login.microsoftonline.com/common/oauth2/v2.0/token/",
[Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),
access_token = Data[access_token]
in
access_token
Then you can follow your video above to get data from the Rest API by access token in first step.
Finally, you can replace bear token by the access token parameter.
It will refresh every time your refresh your report.
Video: How to get access token and call Rest API by dynamic access token in Power BI Desktop? (5:30 to 9:30)
all Power BI Rest API with Dynamic Access Token From Power BI Desktop |Power BI Rest API
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Vinaysingh115 ,
Firstly, we need to get Access token in Power BI Desktop. We will get access token from Power BI by below code.
() =>
let
body = "client_id=" & #"App ID"
& "&scope=https://analysis.windows.net/powerbi/api/.default&client_secret=" & #"App Secret"
& "&grant_type=client_credentials",
Data= Json.Document(Web.Contents("https://login.microsoftonline.com/"& TenantID & "/oauth2/v2.0/token/",
[Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),
access_token = Data[access_token]
in
access_token
OR
() =>
let
body = "&grant_type=Password&resource = https://analysis.windows.net/powerbi/api
&client_id=*****&username=*****&password=*****",
Data=Json.Document(Web.Contents("https://login.microsoftonline.com/common/oauth2/v2.0/token/",
[Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),
access_token = Data[access_token]
in
access_token
Then you can follow your video above to get data from the Rest API by access token in first step.
Finally, you can replace bear token by the access token parameter.
It will refresh every time your refresh your report.
Video: How to get access token and call Rest API by dynamic access token in Power BI Desktop? (5:30 to 9:30)
all Power BI Rest API with Dynamic Access Token From Power BI Desktop |Power BI Rest API
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I am new to Power BI . Can you please let me know where I need to put the code you have mentioned in Power BI to generate access token .
Thanks.
Hi @Vinaysingh115 ,
Click on "Transform data"
-> Right Click in Queries -> Select "Blank Query" in New Query
->Click on Advanced Editor
-> Copy and paste your code into Advanced Editor. Note: You need to replace parameters like "Client_ID" by correct ID.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
7 | |
7 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |