Filters

Summary


Filtering is done by adding a filters= querystring element to any get request. Filters requires an exact match of the filter term against field. When using alongside search, filters are applied before search, so you can also use them to filter out assets you don't need to perform the search on.

Equality Operators


The following equality operators are available to use within the filter:

Operator C Language Equivalent Notes
EQ ==  
NE !=  
LT < not strings
GT > not strings
LE <= not strings
GE >= not strings
CT Contains string only
SW StartsWith string only
EW EndsWith string only

Simple Query


The most simple query is one field/value pair:

    GET /assets?filters=AverageRating+eq+4
    will return all available assets that have an average rating of 4


Join Operators and Multiple Statements


There are two ways to join queries together: AND or OR. It is possible to string multiple operations together:

    GET /assets?filters=AverageRating+GE+3+AND+AverageRating+LE+5
    will return all assets that have a rating >= 3 and <= 5.


Nesting


The system also understands brackets to change the order of operations:

    GET /assets?filters=(AverageRating+EQ+4+OR+AverageRating+EQ+5)
    +AND+Status+EQ+0

    will return all assets that have an average rating of 4 or 5 and a status of 0


It is valid to have more than one set of brackets within the request, as long as both opening and closing brackets are present:

    filters=((A OR B) AND C ) OR D


Case sensitivity


Field names are not case sensitive.

Values are not case sensitive.


Available Filters


The following Filters are currently supported:

  • AssetType
    • Image
    • Video
    • Audio
    • Adobe
    • Document
    • Other
  • Attribute Value
  • AverageRating
    • 1
    • 2
    • 3
    • 4
    • 5
    • 0 (for none)
  • CognitiveColor
    • red
    • orange
    • yellow
    • green
    • blue
    • teal
    • purple
    • pink
    • brown
    • grey
    • black
    • white
  • CreatedBy
  • DateApproved
  • DateCheckedOut
  • DatePendingApproval
  • DateRejected
  • DateUploaded
  • File Extension
  • Status
    • 0 (approved)
    • 2 (pending)
    • 5 (rejected)
    • 7 (expired)
    • 9 (checked out)
  • CognitiveTextInImage

Examples for filtering in specific fields can be found HERE

Search in Category or Lightbox


Searching in a specific category or lightbox is possible by using the 'ANY' operator within a containerfilter:

Search in Category:

    If '91de5383-5144-4b50-8745-bdeedcde4e93' is the category id you want to filter by:

    GET /assets?containerfilter=(CategoryIds/ANY(c: c EQ '91de5383-5144-4b50-8745-
    bdeedcde4e93')&filters=(AssetType+EQ+Image)

    And with escaped characters:

    GET /assets?containerfilter=(CategoryIds%2FANY(c:+c+EQ+%2791de5383-5144-
    4b50-8745-bdeedcde4e93%27))&filters=(AssetType+EQ+Image)+AND+
    (AverageRating+EQ+5)

    will return assets within the category specified that are both images and have
    an average rating of 5

Search in Category and Nested Categories:

    If you want to search in the specific category with the id '91de5383-5144-4b50-8745-
    bdeedcde4e93' and also in all the sub-categories below that category:

    GET /assets?containerfilter=(CategoryIds%2FANY(c:+c+EQ+%2791de5383-5144-
    4b50-8745-bdeedcde4e93%27)+OR+
    CategoryAncestorIds%2FANY(c:+c+EQ+%2791de5383-5144-4b50-8745-
    bdeedcde4e93%27))&filters=(AssetType+EQ+Image)+AND+
    (AverageRating+EQ+5)

    will return assets within the category specified or within nested categories that are
    both images and have an average rating of 5

Search in lightbox:

    If 'f2d39a31-15e3-41f8-abe2-cd255d7f2253' is the lightbox id you want to filter by:

    GET /assets?containerfilter=(LightboxIds%2FANY(l:+l+EQ+%27f2d39a31-15e3-
    41f8-abe2-cd255d7f2253%27))&filters=(AssetType+EQ+Image)+AND+
    (CognitiveColor+EQ+Blue)

    will return assets within the specified lightbox that are both images and have
    cognitive color of blue