# Filtering api responses

**URL:** <https://devforum.zoom.us/t/filtering-api-responses/131541>\
**Category:** Webinars\
**Created:** [April 16, 2025, 7:14am UTC](https://devforum.zoom.us/t/filtering-api-responses/131541 "2025-04-16T07:14:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramprabhu](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@Ramprabhu](https://devforum.zoom.us/u/Ramprabhu)\
**Post date:** [April 16, 2025, 7:14am UTC](https://devforum.zoom.us/t/filtering-api-responses/131541/1 "2025-04-16T07:14:30Z")

</div>

How to filter api responses based on date or status or any other fields? We need filter response from below endpoints.

/users/{userId}/webinars  
/webinars/{webinarId}/registrants  
/past\_webinars/{webinarId}/participants

---

<div class="post-metadata">

**Author:** ![alexm](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexm/32/67701_2.png) [@alexm](https://devforum.zoom.us/u/alexm)\
**Post date:** [April 16, 2025, 3:04pm UTC](https://devforum.zoom.us/t/filtering-api-responses/131541/2 "2025-04-16T15:04:17Z")

</div>

I’m going to assume you’re using a JavaScript back end here for hitting these three endpoints. For all three, you can make use of simple [array filtering](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).

For filtering the webinars, get the array object returned from `response.data.webinars` and filter it; you can use a library called `date-fns` to do some complex date-time tasks:

`import { parseISO, isAfter, isBefore, startOfDay, endOfDay } from 'date-fns';`  
`const items = response.data.webinars;`  
`const date1 = startOfDay(new Date('2025-04-15'));`  
`const date2 = endOfDay(new Date('2025-04-16'));`  
`const filtered = items.filter(item => {`  
` const time = parseISO(item.start_time);`  
` return isAfter(time, date1) && isBefore(time, date2);`  
`});`

Note that you’ll want to make sure that your start/end dates and the webinar `start_time` are in the same time zone, for accuracy, which is a simple ask for `date-fns`. Your best bet is to make sure everything’s cast to UTC.

For filtering the participants, do some similar filtering to `response.data.registrants`:

`const items = response.data.registrants`  
`const desiredStatus = "approved"; // or "pending" or "denied"`  
`const filtered = items.filter(item => item.status === desiredStatus);`

Hope this helps.

EDIT: Made my example code a little bit more perfomant haha

---

<div class="post-metadata">

**Author:** ![Ramprabhu](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@Ramprabhu](https://devforum.zoom.us/u/Ramprabhu)\
**Post date:** [April 17, 2025, 7:12am UTC](https://devforum.zoom.us/t/filtering-api-responses/131541/3 "2025-04-17T07:12:52Z")

</div>

Hi Alex,

Thanks a lot for your reply. But is there a way to get a filtered response from the api itself, particularly the webinar one. Like get only webinars where registration is till open and start time greater than today for example.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 17, 2025, 4:55pm UTC](https://devforum.zoom.us/t/filtering-api-responses/131541/4 "2025-04-17T16:55:45Z")

</div>

Hi @Ramprabhu  
The List webinar registrant endpoint, offers a query param for status. But the List webinar participants does not have a query param for filtering. So I’d agree with @alexm and you would have to manage the filtering yourself

---

<div class="post-metadata">

**Author:** ![alexm](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexm/32/67701_2.png) [@alexm](https://devforum.zoom.us/u/alexm)\
**Post date:** [April 17, 2025, 4:56pm UTC](https://devforum.zoom.us/t/filtering-api-responses/131541/5 "2025-04-17T16:56:14Z")

</div>

> [@Ramprabhu](#):
>
> /users/{userId}/webinars

I do not believe you can make a request for webinars for a specific date or date range; as for the registration status, I don’t believe even the more granular webinar GET request returns that level of detail, either.

---

<div class="post-metadata">

**Author:** ![expertswho](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/expertswho/32/60945_2.png) [@expertswho](https://devforum.zoom.us/u/expertswho)\
**Post date:** [April 17, 2025, 8:24pm UTC](https://devforum.zoom.us/t/filtering-api-responses/131541/6 "2025-04-17T20:24:38Z")

</div>

Have to love the concise code, adding this to my library.

john
