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
dstramilov
Helper II
Helper II

Two or more API queries - refresh error

In Desktop version  I am using Function to get token and pass it  to actual json API queries (10+), but Function feels like doesn't work for API resfresh when I publish data to Power Bi, how can I get data for several queries without Function?
Curently I embed login & pass into each query header & I am getting error on refresh.
In my case token is valid for 15 min, every time I call I am getting new token. 
 
 
Last refresh failed: Thu May 19 2016 08:15:15 GMT-0800 (Alaskan Daylight Time)
Can't connect to the data source.Hide details
Data source type:
Data source error: The credentials provided for the Web source are invalid. (Source at https://api.linkgoeshere.com/reportnamegoeshere.)
Cluster URI: WABI-WEST-US-redirect.analysis.windows.net
Activity ID: 9cf81dee-f58c-4fac-aa54-dbb269d0ee85
Request ID: ad596f2c-9efb-032a-e15d-90822eb6351b
Time: 2016-05-19 16:15:15Z

1 ACCEPTED SOLUTION

Problem is solved by edit time delay between queries.

View solution in original post

2 REPLIES 2
dstramilov
Helper II
Helper II

I am using this query type for each report, so I could have 10+ queries for one data set.

 

let
 authKey = "{""Username"":""USERNAME"",""Password"":""PASSWORDGOESHERE"",""LocationID"":""LOCATIONIFNEEDED""}",
 url = "https://APILINKGOESHERE.com",
 // Uses the authentication/token method to obtain a token
 GetJson = Web.Contents(url,
     [
         Headers = [#"Content-Type"="application/json"],
         Content = Text.ToBinary(authKey),
         RelativePath="/Authentication/AuthorizeUser"
     ]
 )
in
    GetJson

 

Problem is solved by edit time delay between queries.

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