# Getting Events for last minute?

**URL:** <https://community.dynatrace.com/t/getting-events-for-last-minute/39414>\
**Category:** Dynatrace API\
**Tags:** events, dynatrace-api\
**Created:** [April 22, 2023, 5:58pm UTC](https://community.dynatrace.com/t/getting-events-for-last-minute/39414 "2023-04-22T17:58:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [April 22, 2023, 5:58pm UTC](https://community.dynatrace.com/t/getting-events-for-last-minute/39414/1 "2023-04-22T17:58:53Z")

</div>

When using the v2 Events API, if I want to get the list of events of say the last minute, it will give me the list of the events of the last minute, but also the events that are opened and started eventually way before. If I do this every minute, I will have to check the startTime to see if they really happened in the last minute.

To filter this, there seems to be the entitySelector firstSeenTms, but this has to be used with at least a definition of one of the following:

- Entity type
- Dynatrace entity ID

As I want to get them all, which might be the most efficient way of doing it?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [April 24, 2023, 8:38am UTC](https://community.dynatrace.com/t/getting-events-for-last-minute/39414/2 "2023-04-24T08:38:25Z")

</div>

Hi,  
firstSeenMs applies to entities (first time seen). but you want to check events happening from the specified startTime, right? Looks, like you need to iterate the output from the API since specifying from as the input value, just includes events started before, but still being opened.

The API’s eventSelector does not allow specifying startTime or endTime to filter the events precisely. Looks like another product idea is required here.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [April 24, 2023, 9:14am UTC](https://community.dynatrace.com/t/getting-events-for-last-minute/39414/3 "2023-04-24T09:14:36Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364),

Thanks for the firstSeenMs, was not associating it to entities …

Effectively I’m iterating and checking each of the Events. Since I have some Events that don’t disappear, it’s effectively a waste of resources…

Going to put in the Product Idea.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [April 24, 2023, 9:19am UTC](https://community.dynatrace.com/t/getting-events-for-last-minute/39414/4 "2023-04-24T09:19:06Z")

</div>

Product Idea at: [https://community.dynatrace.com/t5/Dynatrace-product-ideas/Timeframe-selector-for-Events-API-to-filter-events-that-started/idi-p/210506](https://community.dynatrace.com/post/210506)
