Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ntanalyze
Frequent Visitor

Running API with One time user password

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

 

The Extract data API:

https://www.expertpowerplus.com/API/api/Consumption/ConsumptionWithPrices?usageType=ActiveEnergyImpo...

 

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

2 REPLIES 2
lbendlin
Super User
Super User

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.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors