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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
EwoutVlugNL
New Member

Dynamic Date Range API

Hello, 

 

My API has hardcoded dates in the URL. How could i update this where "todate" is today?

 

= Json.Document(Web.Contents("https://v9.footfallcam.com/FootfallCam/exportData?infoJson={""cat"":""0"",""id"":[""-1"",""30247"",""37499"",""30754"",""32500"",""33899"",""33829""],""data"":[],""fromdate"":""15/02/2024"",""todate"":""20/02/2024"",""period"":""1"",""dateformat"":""dd/MM/yyyy""}&access_token=480030004500680041006C00640055003300420047004E006F004C00640044005A00560043007100580067007000660075006B00490051003200550033005900760052006F0075002F007200770030005A0053002F0079003700590068004200420045003700430071007700…….”))

 

I have tried the following, with the posts on this community:

= Json.Document(Web.Contents("https://v9.footfallcam.com/FootfallCam/exportData?infoJson={""cat"":""0"",""id"":[""-1"",""30247"",""37499"",""30754"",""32500"",""33899"",""33829""],""data"":[],""fromdate"":""01/01/2023"",""todate"":""" & DateTime.ToText(DateTime.LocalNow(), "dd/MM/yyyy") & """,""period"":""1"",""dateformat"":""dd/MM/yyyy""}&access_token=480030004500680041006C00640055003300420047004E006F004C00640044005A00560043007100580067007000660075006B00490051003200550033005900760052006F0075002F007200770030005A0053002F0079003700……"""))

 

However, this wound work because PowerBI gives me an error:
(500): Internal Server Error
Details:
DataSourceKind=Web
DataSourcePath=https://v9.footfallcam.com/FootfallCam/exportData

When changing the date 20/02/2024, to today 22/02/2024, the data will load, however is the an option to automate this? 

I believe there is! Could you help?

1 REPLY 1
Vijay_A_Verma
Super User
Super User

""" & DateTime.ToText(DateTime.LocalNow(), "dd/MM/yyyy") & """
SHOULD BECOME
"& DateTime.ToText(DateTime.LocalNow(), "dd/MM/yyyy") &"

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors