Forum Discussion
Connecting to API
- 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.
Hello,
You will require authentication key for that API to use header. If you have details you can enter and issue will get resolved.
For refrence you can check below link,
https://www.google.com/search?q=connect+api+with+power+bi&rlz=1C1YQLS_enIN975IN975&oq=connect+api+with+power+bi&aqs=chrome.0.0i512j0i22i30l3.4737j0j4&sourceid=chrome&ie=UTF-8#kpvalbx=_86cYYpb_GIq75OUP8-ahiA819
Thanks,
Prateek G
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.
- Anonymous4 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 ResultRegards,
Xiaoxin Sheng