# Test script to only return values less than 5 minutes old

**URL:** <https://community.postman.com/t/test-script-to-only-return-values-less-than-5-minutes-old/41920>\
**Category:** Help Hub\
**Created:** [December 9, 2022, 3:58pm UTC](https://community.postman.com/t/test-script-to-only-return-values-less-than-5-minutes-old/41920 "2022-12-09T15:58:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brcox9090](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@brcox9090](https://community.postman.com/u/brcox9090)\
**Post date:** [December 9, 2022, 3:58pm UTC](https://community.postman.com/t/test-script-to-only-return-values-less-than-5-minutes-old/41920/1 "2022-12-09T15:58:44Z")

</div>

I have a GET request returning a list of files from a folder. This folder will always have new files in it, and the API is looping often.

I would like to know if there’s a way where I can set a script to only return files less than 5 minutes old.

I’m very new to this and learning on the fly. Trying to get answers on my own, this is one of 3 things holding me up from finishing this project.

thanks for the help!

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [December 9, 2022, 4:27pm UTC](https://community.postman.com/t/test-script-to-only-return-values-less-than-5-minutes-old/41920/2 "2022-12-09T16:27:19Z")

</div>

Are you in control of the API?

Does the API include the time and date stamp?

If not, can it?

If you do have control, this is better controlled at the API level. Code the five minutes rule as an option in the API.

If you can’t do in in the API, then you are limited in what control you have in the GET command. You can only really get all of the data and then filter on it afterwards. Which still relies on data like a timestamp.

---

<div class="post-metadata">

**Author:** ![brcox9090](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@brcox9090](https://community.postman.com/u/brcox9090)\
**Post date:** [December 12, 2022, 1:43pm UTC](https://community.postman.com/t/test-script-to-only-return-values-less-than-5-minutes-old/41920/3 "2022-12-12T13:43:33Z")

</div>

I am not in full control of the API, so I can’t code the five minutes rule as an option unfortunately. The GET command I’m running does return a timestamp down to the second, so I can filter afterwards, honestly just learning how to code and haven’t been able to figure out the filtering part.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [December 12, 2022, 1:57pm UTC](https://community.postman.com/t/test-script-to-only-return-values-less-than-5-minutes-old/41920/4 "2022-12-12T13:57:00Z")

</div>

Can you post an example response (anonymised appropriately)?

Sure someone can help with the filter given the response structure.
