Forum Discussion
Anonymous
4 years agoNot applicable
Connecting to API
Hi experts, I am trying to connect PowerBI to API. I a doing this for the first time, so not sure how to proceed. Looking for your guidance. This is the URL I am trying to connect. https://l...
- Anonymous4 years ago
Anonymous Great, the idea was only to pass the credential in the body and not in header as you were doing earlier.
Anonymous
4 years agoNot applicable
Thanks ghumarepratik21. for the response. I have the client_secret which should be the API key, i believe. Anyways, I will check on this line.
Thanks.
Anonymous
4 years agoNot applicable
HI Anonymous,
AFAIK, these types of parameters(e.g. client id, secret) will be transformed into a binary string and attached to the httprequest 'content' part instead of directly sending the original string from the httprequest header.
let
url = "https://login.microsoftonline.com/xxxxxxx/oauth2/token",
GetJson =
Web.Contents(
url,
[
Headers = [
Accept = "application/json",
ContentType = "application/x-www-form-urlencoded"
],
Content =
Text.ToBinary(
"grant_type=client_credentials&
client_id=xxxxxxx&
client_secret=xxxxxxx&
scope=xxxxxx"
)
]
),
token = Json.Document(GetJson)[access_token],
Result =
Web.Contents(
"https://xxxxx.xxx.com",
[
Headers = [
#"Content-Type" = "application/json",
Authorization = "Bearer " + token,
RelativePath = "/xxxxx/xxxxx"
]
]
)
in
Result
Regards,
Xiaoxin Sheng