Mux Logo
Get what you want with new list filters
Get what you want with new list filters

Get what you want with new list filters

08/02/2021August 2, 2021(2 months ago)
3 min read
08/02/2021August 2, 2021(2 months ago)
3 min read

Get what you want with new list filters

We’re always looking out for ways to improve the experience for developers using APIs and Mux Video. Today we have some exciting news: we’ve added new list filters! We’ve recently added upload_id and live_stream_id filters to the List assets API and a stream_key filter to the List live streams API.

Prior to these filters, developers had implemented some interesting solutions. Some developers created databases to maintain these relationships to avoid multiple scanning queries. Other developers would loop through entire lists of assets or live streams to find what they needed.  Developers found they quickly reached their API rate limit with multiple queries. All those additional queries would lead to higher response times to complete a task.

The new filters allow developers to be more efficient in their queries and make finding things less cumbersome. Here are examples of how to use each filter using curl. Fire up your favorite terminal and try it out!

To find asset by a specific upload_id

Previously, this was a two-step lookup. You would have to find the specific asset id by doing a GET upload_id lookup: https://api.mux.com/video/v1/uploads/${UPLOAD_ID}, retrieve the asset_id, then using the asset_id in the second request to get the asset details: https://api.mux.com/video/v1/assets/${ASSET_ID}. Now, this process is simplified, and reduced to one step.

🚧 Note: The upload_id filter will work on all assets created using Direct Uploads after June 4th. We're working on adding the corresponding upload_id to all historic assets.

To find all assets with a specific live_stream_id

Some developers assign a persistent live_stream_id to their streamers publishing multiple events. This live_stream_id filter can come in handy if you want to list all the live stream recordings that were created with your persistent live_stream_id for post-event publishing.

Without this filter, the lookup process is less than ideal, requiring you to make requests to https://api.mux.com/video/v1/assets to list assets, loop through the results finding elements with a matching live_stream_id, then make additional page requests. We’re happy to say, that this new filter improves things, making it all one request.

To find the live stream created with a specific stream_key

Before introducing this filter, you would do a lookup https://api.mux.com/video/v1/live-streams, then loop through live streams to find a matching stream_key field. Depending on the number of live streams you had, this could require looking at multiple pages of results. Now, the process becomes quicker and you can use the stream_key as a filter to get what you need.

We hope these additional filters allow for some optimization and less coding for all of you. Are there any other filters you wish you had? Let us know!

Subscribe to the Mux newsletter