Forum Discussion
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.
When I connect, its failing with Datasource error. (in power bi)
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
- ImkeF
Community Champion
Hi Anonymous ,
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?- AnonymousNot applicable
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.
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
- ImkeF
Community Champion
Hi Anonymous ,
if its the same query than in PBI, then I'm afraid I am running out of ideas here.
Looks like a bug.- AnonymousNot applicable
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
Hi Anonymous ,
any chance you can whitelist the domain name instead?
Not sure that powerbi.com runs under one dedicated IP address.