CMS API: Playlists Search

In this topic, you will learn how to search for playlists in your Video Cloud account. The CMS API provides a programmatic way to search for playlists in your Video Cloud library. Here we will look at the search syntax.

Introduction

Playlists for an account can be searched by providing a q parameter to the above call similarly to the provided Video Search functionality. Be aware, however, that a much smaller number of fields can be searched, and that only the playlist properties are searched, not properties of the videos contained in the playlist.

Any unqualified/default terms will search for any text match in the name, reference_id, or id field of a Playlist, for example a search for ?q=news+2016 would match any of the following if they exist:

  • A Playlist with a name of Exciting 2016 News
  • A Playlist with an id of 2016
  • A Playlist with a reference_id of news 2016

As implied above multiple terms provided are OR'ed together, and strings containing one or more of the provided terms will be returned. Provided values are stemmed, so variations on the words will be matched. Prefix matching is not currently supported. So for instance a search for p* will not return results starting with "p" nor will a search for play* return results containing "playlist".

Ignored words

Certain words are ignored in search strings because they are so common that they are likely to return many results unrelated to what you are actually searching for. Below is a list of words that are ignored by search:

"a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"

In addition, non-alphanumeric characters such as hyphens, underscores, line-breaks, "$", "&", "*", etc. are treated as word delimiters. For example, a search string like small-town will be treated as small town.

Fields

Specific fields can be queried by using the {field:}{value} syntax such as ?q=news+2016+type:EXPLICIT. Fields provided this way must match exactly. Like other terms these will be OR'ed.

The following fields are currently supported:

  • type
  • name
  • description
  • reference_id

Required terms

You can require terms by prefixing them with a URI-encoded + sign (%2B) - example: q=name:%2Bnews+%2B2016 (which would return only playlists with names including both "news" and "2016").

Excluded terms

Prefix terms with a URI-encoded - sign to exclude playlists with that term. For example: q=name:%2Bnews+%2D2016 will return videos that have names containing "news" but not containing "2016".

Stemming

Stemming refers to storing and searching for the roots of words. What this means is that the terms "play", "playing", "plays", "played"... will all be stored as "play" and when a search is done for any of those terms the search will accordingly be translated to search for "play". Stem only applies to the root of the word, and not a string that begins or is part of the word. Therefore, a search on name:play will returned videos with names containing "play", "played", "playing", and "playable", but will not return videos with names that contain "display" or "playlist".

AND/OR

You can combine search conditions with AND and OR logical operators. To avoid ambiguity (is AND an operator or part of the search string?), you need to put terms that precede logical operators in parentheses like this:

q=(Really Short Videos) AND type:EXPLICIT

Encoded, this search request would look like this:

q=name:%28Really%20Short%20Videos%29%20type:EXPLICIT

Full examples

Search by type

    https://cms.api.brightcove.com/v1/accounts/account_id/playlists?q=type:ACTIVATED_NEWEST_TO_OLDEST

Search by name with exclusions

    https://cms.api.brightcove.com/v1/accounts/account_id/playlists?q=%2Bname=morningnews+%2Ddecription=weekend