Forum Discussion
vwiles84
6 years agoHelper III
Rest API - 90 Day restriction
I have access and connected to a rest API to pull in some sales data. The api is restricted to 90 days worth of data. My question is, how do I configure Power BI to pull in current data while archiv...
Mariusz
6 years agoCommunity Champion
Hi vwiles84
You can create a table in Power Query with multiple URL strings as rows containing 90 windows and then call all and app and into one dataset
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
parry2k
6 years agoSuper User
vwiles84 this M code will create start and end date range and will update daily, just add another column and make api call from the WebURL column and you are good to go.
let
MaxDays = 90,
EndDate = Date.From(DateTime.LocalNow()),
StartDate = Date.AddDays(Date.From(EndDate),1-MaxDays),
Source = #table({"StartDate","EndDate"} ,{{StartDate,EndDate}}),
#"Changed Type1" = Table.TransformColumnTypes(Source,{{"StartDate", type datetime}, {"EndDate", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "WebURL", each "https://website/order_items?time_start=" &
DateTime.ToText([StartDate],"yyyy-MM-dd")&"&time_end="&DateTime.ToText([EndDate], "yyyy-MM-dd"), type text),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "WebData", each Web.Contents([WebURL]))
in
#"Added Custom1"