Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |