Forum Discussion
This dataset includes a dynamic data source: how to replace "each <function-call>"?
- 4 years ago
Hi Boeboey
To refresh the dynamic data source in Power BI Service, you can use the RelativePath and Query options with the Web.Contents M function. You could first refer to the following blogs to get some basic understanding.
Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code
Setting a scheduled refresh on a Dynamic Data Source in Power BI
According to your URL, you can try using RelativePath option. Your URL structure is similar to the example in above latter link.
From
url = "https://api.mywebsite.com/api/device/"&Number.ToText(DeviceID)&"/data/events/export", GetJsonQuery = Csv.Document(Web.Contents(url, [Headers=[Authorization=AccessTokenHeader, Accept="application/json"]]),[Delimiter=";", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None]),to
baseURL = "https://api.mywebsite.com/api", GetJsonQuery = Csv.Document(Web.Contents(baseURL, [Headers=[Authorization=AccessTokenHeader, Accept="application/json"], RelativePath="device/"&Number.ToText(DeviceID)&"/data/events/export"]),[Delimiter=";", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None]),You may need to adjust the baseURL because the trick of using the RelativePath and Query options with Web.Contents() only works if the first parameter (baseURL) passed to Web.Contents() is a url that itself can be called on its own without an error.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi Boeboey
To refresh the dynamic data source in Power BI Service, you can use the RelativePath and Query options with the Web.Contents M function. You could first refer to the following blogs to get some basic understanding.
Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code
Setting a scheduled refresh on a Dynamic Data Source in Power BI
According to your URL, you can try using RelativePath option. Your URL structure is similar to the example in above latter link.
From
url = "https://api.mywebsite.com/api/device/"&Number.ToText(DeviceID)&"/data/events/export",
GetJsonQuery = Csv.Document(Web.Contents(url, [Headers=[Authorization=AccessTokenHeader, Accept="application/json"]]),[Delimiter=";", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None]),
to
baseURL = "https://api.mywebsite.com/api",
GetJsonQuery = Csv.Document(Web.Contents(baseURL, [Headers=[Authorization=AccessTokenHeader, Accept="application/json"], RelativePath="device/"&Number.ToText(DeviceID)&"/data/events/export"]),[Delimiter=";", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None]),
You may need to adjust the baseURL because the trick of using the RelativePath and Query options with Web.Contents() only works if the first parameter (baseURL) passed to Web.Contents() is a url that itself can be called on its own without an error.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.