Forum Discussion
Connect to API through Power Query doesn´t work, but does in Power Automate
- 1 year ago
Hi Hamp79,
As trouble shooting steps doesn’t resolve your issue, we recommend raising a support ticket with Microsoft for further assistance.
To raise a support ticket for Fabric and Power BI, kindly follow the steps outlined in the following guide:
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.
Thank you for being a part of Microsoft Fabric Community Forum!
Hi again, here it is... Thanks in advance.
let
//
TokenUrl = "xxxxx/oauth2/v2.0/token",
TokenBody = [
grant_type = "client_credentials",
client_id = "xxxxx",
client_secret = "xxxxxx",
scope = "api://xxxxx"
],
//
TokenResponse = Json.Document(Web.Contents(TokenUrl, [
Content = Text.ToBinary(Uri.BuildQueryString(TokenBody)),
Headers = [#"Content-Type" = "application/x-www-form-urlencoded"]
])),
//
AccessToken = TokenResponse[access_token],
//
ApiResponse = Web.Contents("https://xxxxx/GetASSIGNED_TO", [
Headers = [
#"Ocp-Apim-Subscription-Key" = "xxxxx",
Authorization = "Bearer xxxxxx"
]
]),
json = Json.Document(ApiResponse),
table = Table.FromRecords(json)
in
table
Thank you so much. i was struggling for a week. Finally I found the exact code that is working for me