Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bickychoudhary
New Member

Unable to call Rest API

Hi All,

We are trying to call one of our api to generate access token for one of our automation work.

Using below configuration.

bickychoudhary_1-1695129010467.png

When I connect, its failing with Datasource error. (in power bi)

bickychoudhary_2-1695129225419.png

But the same service is retuning response access token from postman or even with desktop app.
Any suggestions on this will be much appreciated.

 

 

 

5 REPLIES 5
ImkeF
Community Champion
Community Champion

Hi @bickychoudhary ,
any chance you can whitelist the domain name instead?
Not sure that powerbi.com runs under one dedicated IP address.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ImkeF
Community Champion
Community Champion

Hi @bickychoudhary ,
if its the same query than in PBI, then I'm afraid I am running out of ideas here.
Looks like a bug.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi @ImkeF , Thanks for your thoughts,

Is there any method for retrieving the IP address of the Power BI cloud service? I attempted a GET request to another service using the query, and it provided a response. I have a suspicion that the service "https://api.apm****.com" may be limiting calls from Power BI, so we might need to add the Power BI cloud's IP address to the whitelist.

ImkeF
Community Champion
Community Champion

Hi @bickychoudhary ,
have you copied the query over from PBI Desktop or could it be that you have a typo in row 8: 
acessAuth instead of accessAuth?
Otherwise: Any more hints if you click on "Show Details" in the error-message?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi @ImkeF

 

I am using pwerbi cloud - i.e, https://app.powerbi.com/ ,

The query is working fine on the desktop app, but when I try to call the service from power bi cloud, Looks like its unable to make the call to the rest api for generating the token's.

 

bickychoudhary_0-1695199903682.png

Below is the query i am try to hit.

let
Url = "https://api.apm****.com",
credentials =
[
client_id = "E5eUI7PBFfVLuKrJHhyw**",
client_secret = "Iu3Ih9eQ**"
],
acessAuth =
Json.Document(Web.Contents(
Url,
[
RelativePath = "oauth/client_credential/accesstoken",
Query =
[
grant_type = "client_credentials"
],
Headers =
[
#"Content-Type"= "application/x-www-form-urlencoded"
],
Content = Text.ToBinary(Uri.BuildQueryString(credentials))
]
)
),
token = acessAuth[access_token]
in
token

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors