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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
EwoutVlugNL
Regular Visitor

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors