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'm trying to connect to another part system using API.
The API requires the user to be authenticated to the system using the “Login” action. Once
the user is authenticated successfully, he can call the required actions according to the
specification.
The Login API: https://www.expertpowerplus.com/API/api/Login?userName=demo&pass=12345678
Whe I used postman I used the login API as a pre-request script and it work.
However when i tried to extract the data using Power Query it said:
"We Couldn't authenticate with the credentails provided.
My query is:
let
timeout = #duration(0, 0, 5, 0),
url = Json.Document(Web.Contents("https://www.expertpowerplus.com/API/api/Login?userName=user&pass=password")),
body="{ ""usage_type"":1,
""StartDate"": ""2022-12-01"",
""EndDate"": ""2022-12-29"",
""PeriodType"": 3,
""DeviceList"": [
171887],
}",
Source = Json.Document(Web.Contents("https://www.expertpowerplus.com/API/api/Consumption/ConsumptionWithPrices?usageType=ActiveEnergyImpo...",
[Timeout=timeout,
Headers=[#"Content-Type"="application/json; charset=utf-8"],
Content=Text.ToBinary("")]), 65001),
data = Source[data],
#"Converted to Table" = Record.ToTable(data)
in
#"Converted to Table"
Please your help.
Best Regards
Nir Tal
you seem to have a circular reference
data = Source[data]
I think you meant to say
data = url[data]
Fix the login step first before attempting the data retrieval step.
Hi
Thank fir your answer, but it still didn't solve the problem.
It keep asking me for credentials.
As i said the credentials provided in the first url.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 17 | |
| 9 | |
| 9 | |
| 7 | |
| 7 |