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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors