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.
The FilterDefinition object contains the following important properties:
All date values for a simple filter part must go into the DateValue collection.
- ObjectID - The Marketing Cloud application generates a unique identifier for this property upon creation.
- CustomerKey - A client-supplied identifier for the filter. This must be unique across all FilterDefinitions owned by the client.
- Name - The name of the filter must be unique, but do not use the name for lookup purposes.
- Description - The 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 Type | Valid Values |
---|---|
Boolean | True or False |
Date | ShortDate (date with no time) |
List | Not supported |
Numeric | Bigint |
Data Type | Valid Values |
---|---|
Boolean | Equals |
Date |
|
List |
|
Numeric |
|
Text |
|
The sample code below sets up a filter definition with a complex filter based on the criteria below:
Using this 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.