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! Request now

Reply
Anonymous
Not applicable

Rest Api and Parameter for current date

Hello,

 

I have a Rest Api with a date filter for a query. Last I had to change the date everyday to get the new data for the current date. So I started to write a  parameter which gives me the current date and put it in the soruce. The Parameter works and I get the right data but when  I save and close the Queries I geht this answer: 

vollkiri_0-1678191107249.png

 

Can someone help me to fix the problem?

 

 

here is my Code: 

 
let
  //Create a query parameter for today's date
 today = DateTime.Date(DateTime.LocalNow()),
  // Convert the date to the desired text format for the filter
  todayFilter = Date.ToText(today, "yyyy-MM-dd"),
  // Replace the date in the existing filter set with today's date
  newFilter = "filter[0][property]=orderTime&filter[0][expression]=>=&filter[0][value]=" & todayFilter,
  // Combining the URL and the new filter
  urlwithFilter = "Soruce?" & newFilter,
  // Get the data from the URL with the new filter
  Quelle = Json.Document(Web.Contents(urlwithFilter)),

 

 

 

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

You'll need to leverage the RelativePath term in Web.Contents to get around the dynamic source error.

Chris Webb's BI Blog: Using The RelativePath And Query Options With Web.Contents() In Power Query An...

Pat

Microsoft Employee
Anonymous
Not applicable

thank you. Now I can save and close my query. But I have a new problem that I can't refresh. 

I get this response: 

 

Requested on,Dataflow name,Dataflow refresh status,Table name,Partition name,Refresh status,Start time,End time,Duration,Rows processed,Bytes processed (KB),Max commit (KB),Processor Time,Wait time,Compute engine,Error,
2023-03-08 12:19:17,M4M,Failed,Rest Api,NA,Failed,2023-03-08 12:19:17,2023-03-08 12:19:18,00:00:00.6240,NA,NA,NA,NA,NA,NA,Error: The current operation was canceled because one or more operations failed..  Request ID: d4a58d3e-4f34-c3eb-86ed-24fdc03e6117.
2023-03-08 12:19:17,M4M,Failed,Rest Api mit Parameter,NA,Failed,2023-03-08 12:19:17,2023-03-08 12:19:18,00:00:00.5300,NA,NA,NA,NA,NA,NA,Error: Credentials not found for data source '<ccon>{"Kind":"Web" "Path":"source" "NormalizedPath":"source "IsDefaultForKind":false}</ccon>'.. Param1 = <ccon>{"Kind":"Web" "Path":"source" "NormalizedPath":"source" "IsDefaultForKind":false}</ccon> Request ID: d4a58d3e-4f34-c3eb-86ed-24fdc03e6117.

 

 
 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.