Forum Discussion
Web.Contents with the Content option is supported only when connecting anonymously.
- Anonymous3 years ago
Hi Anonymous ,
Here is the sample code(use token to login and get access token for following operations) about use anonymous mode authorization to get data from web connector, you can take a look on it if helps:
let url = "api.xxxx.com", body = "{}", token = "xxxxxxxx", header = [ #"Content-Type" = "application/json", #"Authoritation" = "Basic " & token ], response = Web.Contents(url, [ RelativePath = "/xxxx/login", Headers = header, Content = Text.ToBinary(body) ]), AccessToken = Json.Document(response)[access_token], JsonResponse = Web.Contents( url, [ RelativePath = "/xxx/xxx", Headers = [ Authoraztion = "Basic " & AccessToken, #"Content-Type" = "application/json" ] ] ), Result = Json.Document(JsonResponse) in ResultRegards,
Xiaoxin Sheng
- 3 years ago
Hello
Finally, I got it to work with the code I was providing. It would be necessary to pass the authentication method in the Header of the request and at the moment in which Power BI asks for the credentials, choose the option of "Anonymous". In this way, it connects correctly.
Thank you.
Hello
Finally, I got it to work with the code I was providing. It would be necessary to pass the authentication method in the Header of the request and at the moment in which Power BI asks for the credentials, choose the option of "Anonymous". In this way, it connects correctly.
Thank you.