Forum Discussion
JSON web API change end date (To=) to today
Please assist if possible,
I have connected to an API via the web connecter. When i try to change the "to" date (end date) to "Today" in Advanced Editor, i get an error.
How would i manipulate the date below to pull in today's date as the end date?
let
Source = Json.Document(Web.Contents("https://customer-va.call.com/callmetrics/table/jsonStatsApi.do?queues=*&from=2020-01-01.00:00:00&to=2022-04-12.23:59:59&block=Details.Calls1")),
Thank you
- Anonymous4 years ago
Hi ClaireBear ,
Please try to update the source codes as below using the function DateTime.LocalNow and check if it can retrieve the data successfully...
let
Source = Json.Document(Web.Contents("https://customer-va.call.com/callmetrics/table/jsonStatsApi.do?queues=*&from=2020-01-01.00:00:00&to=DateTime.LocalNow() &block=Details.Calls1")),In addition, you can refer the following link to get it.
dynamic web url - always todays date
endDateText = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-mm-dd"),
Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate="&endDateText))
Best Regards
1 Reply
- AnonymousNot applicable
Hi ClaireBear ,
Please try to update the source codes as below using the function DateTime.LocalNow and check if it can retrieve the data successfully...
let
Source = Json.Document(Web.Contents("https://customer-va.call.com/callmetrics/table/jsonStatsApi.do?queues=*&from=2020-01-01.00:00:00&to=DateTime.LocalNow() &block=Details.Calls1")),In addition, you can refer the following link to get it.
dynamic web url - always todays date
endDateText = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-mm-dd"),
Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate="&endDateText))
Best Regards