Solved

Get Events API: is there a way to pass a date range

  • 7 February 2023
  • 4 replies
  • 163 views

Badge +1

I’m using the Get Events API (2023-01-24) and trying to get events using a filter that includes events that occurred greater than or equal to {{date 1}} and less than {{date 2}}.   I'm able to successfully get data using greater-than-equal, but as soon as I add “and” and the ‘less than’ date, I get a 400.  Could be the filter is incorrect.. but hoping someone has an example.  Here is what we are currently passing:

?filter=and(greater-or-equal(datetime,1970-01-01T12:00:00Z), less-than(datetime,2023-02-07T17:40:09.274Z))
icon

Best answer by Brian Turcotte 20 March 2023, 19:51

View original

4 replies

Userlevel 7
Badge +36

Hi @LoriM and welcome to the Community!

 

From my perspective, it looks like the call is formatted correctly, so I am going to reach out to Engineering to see if they can provide some more context here. Especially since this other Community member mentioned the exact same issue on the same day, here:

 

I will update the thread as soon as I learn more about what could be causing this. 

 

Thanks for using the Community!

- Brian

Badge +1

Hi Brian - I was just curious if you had heard anything back on this one yet.  Thanks!

Userlevel 7
Badge +36

Hi@LoriM!

 

I’m so sorry for the delay in response here!

 

Unless I’m mistaking your intent, I don’t believe you need the “and” logic to include both the greater-or-equal and less-than modifiers. We did some testing, and a call in this format should yield the desired results:

{{baseUrl}}/api/events/?filter=greater-or-equal(datetime,2022-04-01T11:30:00Z),less-than(datetime,2022-07-01T11:30:00Z)

 

If you remove the and statement, does the error still persist?

 

Thanks,

Brian

Badge +1

yes, that worked, thank you Brian!

Reply