When you perform a search, the platform returns all the relevant matches. Filtering narrows the scope of your query. The platform allows you to filter your search results based on metadata or the level of confidence that the search results match your query.
To filter your search results based on metadata, use the filter parameter.
The filter parameter is of type Object and can contain both system-generated and user-provided metadata fields.fields. For details on system-generated metadata, see the Video object page. For details on providing custom metadata, see the Update video information page.
To indicate the relationship between a field and its value, you can use the exact match or comparison operators.
The exact match operator matches only the results that equal the value you specify. The syntax is as follows: <field>: <value>.
Use the comparison operators (lte and gte) to match based on the arithmetic comparison. The syntax is as follows: <field>:{"gte": <value>, "lte": <value}.
You can filter on multiple fields by adding the fields you want to filter on to the filter parameter as shown in the Filter on size, width, and height section below.
The following example code uses the id field of the filter parameter to filter on a specific video ID:
The following example code uses the id field of the filter query parameter to filter on multiple video IDs:
The example code below uses the size, width, and height fields of the filter parameter to return only the matches found in videos that meet all the following criteria:
50000000 bytes and less and equal to 53000000 bytes.850.400 and less and equal to 500.The example code below filters on a custom field named views of type integer. The platform returns only the results found in the videos for which the value of the views field equals 120000.