cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Dynamic Date in Web Query

I am trying to do a POST request using the blank query editior. I need to include a body query within the source to specify the date in yyyy-mm-dd format. If I manually type the date i.e. 2022-05-22 then my query pulls data from the site. However, I am trying to make the query reference today's date, so that at any point in time I am referencing the latest data. Unfortunately the date is required in the body for this provider.

 

I am struggling to pull today's date, in the format, and pass it through to my URL. Below is the working query, where I specifiy the date manually. How do I make that date always be todays date?

 

let

body = "{""Dates"":""2022-05-22""}",
Source = Json.Document(Web.Contents("https://app.officevibe.com/api/v2/engagement", [Headers=[Authorization="Bearer fakeapikey123423424242424", #"Content-Type"="application/json"], Content = Text.ToBinary(body)]))
in
Source

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

For body use this

body = "{""Dates"":"&""""&Date.ToText(Date.From(DateTime.FixedLocalNow()),"yyyy-MM-dd")&""""&"}",

Thank you very much Vijay. That worked a treat.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (1,463)