I am working with a peculiar API setup, where the company has designed their API to require a start and end time with the request, with a 6 hour limit. What this means right now is that for a feed I want to hit every couple of minutes, I have to write that into the URL - and it will error once that start time has lapsed 6 hours or if I do not include the start time. It also conveniently includes all the data in the last 6 hours unless I include an end time.
My idea is that the url (or URL parameters) when building a feed (in this particular case is the HTTP Poller) would allow me to create a dynamic url with some arcade so I can basically change the url parameters automatically at each scheduled reoccurring hit.
So I can say something like.... ?start_time={Now()}&end_time={Now()-2minutes)}
Hey @Teresa_Blader ,
Currently, the HTTP Poller feed type allows us to us to use the following global variables in the URL parameters, Custom headers, or the POST body parameters:
$feed.FeedStartTime—The time the feed was started.
$feed.FeedScheduledStartTime—The time the next recurrence of the feed is scheduled.
$feed.FeedLastScheduledStartTime—The time the last recurrence of the feed was scheduled.
In your example, you've provided the URL parameters "start_time={Now()}&end_time={Now()-2minutes)}".
If we set the HTTP Poller feed to run every 2 minutes and set URL parameters start_time = $feed.FeedScheduledStartTime and end_time = $feed.FeedLastScheduledStartTime, ArcGIS Velocity would replace those global variables with epoch timestamp values.
In we configured the feed to run every 2 minutes with these URL parameters and the feed ran at "December 23, 2024 10:24:00.000 AM GMT", the previous run time would be "December 23, 2024 10:22:00.000 AM GMT", so ArcGIS Velocity would make a request to https://httppoller.example/?start_time=1734967440000&end_time=1734967320000
If this workflow does not work for your API, please send me a direct message with an email address I can contact you at to get more details. Thanks!
Wow!! Well that's exciting.
The API is using a non epoch timestamp, but I've set the global variables data format as yyyy-MM-dd'T'HH:mm:ss'Z'
It appears to be working... so the global variables either controls the timestamp format in the url or the API can use epoch?? ... not sure!
URL parameters:
{"start_time":"$feed.FeedLastScheduledStartTime","end_time":"$feed.FeedScheduledStartTime"}
Hey @Teresa_Blader,
Glad to hear that this is working! Yes, both the HTTP Poller and Samsara feed types have the ability to convert the global variables to a custom datetime format using the optional "Global Variables" parameter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.