Published on August 2, 2021 (almost 3 years ago)

Get what you want with new list filters

Kelley Duran
By Kelley Duran3 min readProduct

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!

LinkTo find asset by a specific upload_id

curl${UPLOAD_ID} \ -X GET \ -u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET} \ -H "Content-Type: application/json"

Previously, this was a two-step lookup. You would have to find the specific asset id by doing a GET upload_id lookup:${UPLOAD_ID}, retrieve the asset_id, then using the asset_id in the second request to get the asset details:${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.

LinkTo find all assets with a specific live_stream_id

curl${LIVE_STREAM_ID} \ -X GET \ -u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET} \ -H "Content-Type: application/json"

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 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.

LinkTo find the live stream created with a specific stream_key

curl${STREAM_KEY} \ -X GET \ -u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET} \ -H "Content-Type: application/json"

Before introducing this filter, you would do a lookup, 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!

Written By

Kelley Duran

Former American Sign Language linguist turned programmer. Got started with video technology when working on Video Relay Service applications. She loves skiing and lives around hills instead of mountains.

Leave your wallet where it is

No credit card required to get started.