The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi all,
I trying to fetch data via API which needed dynamic token; I am successful in retriving data in Power BI desktop but when I publish the same on Power BI Service I am getting an error (when refresh) as below,
This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. Learn more: https://aka.ms/dynamic-data-sources.
Here is what I had tried to get Token:
// I created parameters (URL, grant_type...) & using them here ,
---------------------------------------------------------------
= () =>
let
url = URL,
body = [
grant_type = grant_type,
client_id = client_id,
client_secret = client_secret,
username = username,
password = password
],
nice = Json.Document(Web.Contents(url,
[
Headers = [#"Content-Type" = "application/x-www-form-urlencoded"],
Content = Text.ToBinary(Uri.BuildQueryString(body))
]
)
),
niceToken = nice[access_token]
in
niceToken
---------------------------------------------------------------
Above code is successfully returning the token when I invoke it. now I am trying to use this dynamic token into the main call,
---------------------------------------------------------------
let
Source = Json.Document(Web.Contents(DataURL,
[
Headers=[Authorization="Bearer " & Token()]
]))
in
Source
---------------------------------------------------------------
Which is returning data to me in Power BI Desktop but same not working in Service; what could be the potential issue?
Appreciate your help.
Solved! Go to Solution.
I got the solution from Curbals youtube video.
all dynamic parts must be added as query then it will work.
Json.Document(Web.Contents(DataURL,
[
RelativePath = "performance?",
Query = [
startDate=sDt,
endDate=eDt
],
Headers=[Authorization="Bearer " & Token()]
]))
@Anonymous , refer if this can help
https://www.advaiya.com/generate-dynamic-token-and-get-data-from-custom-api-in-power-bi/
Thanks @amitchandak ,
If you look at the code I shared; I have already implemented the solution mentioned in the blog. I even getting the data but its not working in PBI Service due to dynamic parameter (dates).
Appreciate if you can help on that.
I got the solution from Curbals youtube video.
all dynamic parts must be added as query then it will work.
Json.Document(Web.Contents(DataURL,
[
RelativePath = "performance?",
Query = [
startDate=sDt,
endDate=eDt
],
Headers=[Authorization="Bearer " & Token()]
]))
Hello, I have a very similar problem when putting a dynamic hour directly in my query, could you tell me what is the link of the curbals video you are talking about?