Creating a FilterDefinition Object

Use the FilterDefinition object to separate out information for a data source, such as a subscriber list or a data extension. Use the sample code below as a model for creating your own API call.

All date values for a simple filter part must go into the DateValue collection.

The FilterDefinition object contains these properties.

ObjectID

A unique identifier for the property.

CustomerKey

A client-supplied identifier for the filter. This must be unique across all FilterDefinitions owned by the client.

Name

A unique name for the filter. Don’t use the name for lookup purposes.

Description

A description of the filter.

DataSource

Specifies whether the filter is list-based or data-extension-based. If the filter is based on a data extension, supply a DataExtension object. Otherwise, leave this value null and the filter uses profile attributes.

DataFilter

This property specifies the rules associated with the filter. You can include measures here.

Data TypeValid Values
BooleanTrue or False
DateShortDate (date with no time)
ListNot supported
NumericBigint
Data TypeValid Values
BooleanEquals
Date
  • equals
  • notEquals
  • isAnniversary
  • isNotAnniversary
  • greaterThan
  • greaterThanAnniversary
  • lessThan
  • lessThanAnniversary
List
  • equals
  • notEquals
Numeric
  • equals
  • notEquals
  • greaterThan
  • greaterThanOrEqual
Text
  • equals
  • notEquals
  • greaterThan
  • greaterThanOrEqual
  • lessThan
  • lessThanOrEqual
  • existsInString
  • existsInStringAsAWord
  • notExistsInString
  • beginsWith

This code example creates a filter definition with a complex filter.

Using these criteria, the API performs the call on the test_subject_line data extension:

The update call supports both CustomerKey and ObjectID as identifiers to specify which FilterDefinition to update. The API requires both the DataExtension and DataFilter to update a FilterDefinition object.