Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi
I am struggling to connect to a dataset through API.
A sample PBIX file was provided by the data host however the simple action of switching out the API keys fails connect.
extract here from the advanced editor
let
url = "https://api.workguru.io/api/ClientTokenAuth/Authenticate/api/client/v1/tokenauth",
body = "{ ""ApiKey"": ""YOUR_API_KEY_"", ""Secret"": ""YOUR__API_SECRET"" }",
tokenResponse = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] )),
AccessToken = tokenResponse[accessToken],
AccessTokenHeader = "Bearer " & AccessToken,
data_url = "https://api.workguru.io/api/services/app/ClientPivotReport/GetAllActivityLinesInPeriod?start=01/01/2...",
data_body = "{
""authorization"": """& AccessTokenHeader & """,
""content-type"": ""application/json""
}",
GetGroups = Json.Document(
Web.Contents(
data_url,
[
Headers = Json.Document(data_body)
]
)
),
categories = GetGroups[result],
#"Converted to Table" = Table.FromList(categories, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"SourceDocNo", "SourceDocName", "Project", "Source", "Quantity", "Item", "UnitCost", "UnitPrice", "Client", "ClientId", "BillingClient", "Code", "Supplier", "Cost", "Revenue", "Profit", "GP", "Document", "ReportingCategory1", "ReportingCategory2", "OwnerOrManager", "CustomFieldValues", "Region", "ProductCategory", "Date", "Year", "Day", "Month", "Qtr"}, {"SourceDocNo", "SourceDocName", "Project", "Source", "Quantity", "Item", "UnitCost", "UnitPrice", "Client", "ClientId", "BillingClient", "Code", "Supplier", "Cost", "Revenue", "Profit", "GP", "Document", "ReportingCategory1", "ReportingCategory2", "OwnerOrManager", "CustomFieldValues", "Region", "ProductCategory", "Date", "Year", "Day", "Month", "Qtr"})
in
#"Expanded Column1"
My ammendment.
body = "{ ""ApiKey"": ""123456789"", ""Secret"": ""123456789"" }",
The error I get is "We couldn't authenticate with the credentials provided. Please try again." but I have confirmed the credentials are correct.
Hi @Anonymous
Please check that.
1.The body of getting access token is right, it may be affected by the token.
2.Please make sure your token is not expired, the token often have one-hour lifetime, if the token is expired, you need to get the token again.
and you can refer to the following link.
Solved: Pull data from a REST API Authentication - Microsoft Fabric Community
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |