Campaign Category Filter API

The Campaign Category Filter API allows you to pull in Campaign categories into different parts of the website.

Minimum Tag
{ap_api:campaign:categoryFilter templateId="1"}

Example Tags

{ap_api:campaign:categoryFilter templateId="1" limit="5" random="yes"}
This will return 5 categories in a random display order.

{ap_api:campaign:categoryFilter templateId="1" sort[name]="asc" limit="10"}
This will return 10 categories sorted in ascending order (A - Z) by their category name.

{ap_api:campaign:categoryFilter templateId="1" sortKey="publishedOnTimestamp" sortDirection="desc" limit="10"}
This will return 10 categories in chronological order with the newest category displayed first.

Tag Parameters

ParameterDescription
attr Type: Array
Description: List of attribute layout keys and the values that the filter should match.
Example: attr[layoutKey]="value"
getCampaigns Type: String
Description: Whether or not to get any campaigns for each category.
Accepted values: true, false, 1, 0, yes, no
Example: getCampaigns="yes"
getSubCategories Type: String
Description: Whether or not to get any subcategories for each category.
Accepted values: true, false, 1, 0, yes, no
Example: getSubCategories="yes"
keys Type: String
Description: Comma separated list of layout keys that will be used to only return that data.
Example: keys="layoutKey1, layoutKey2"
limit Type: Integer
Description: The number of results to return. Defaults to return all matching results (no limit).
Example: limit="5"
match Type: String
Description: Whether or not to match all conditions or any of the conditions. 'any' or 'all'. Defaults to 'all'.
Example: match="any"
random Type: String
Description: Whether or not the results will be returned in random order.  If sorting is setup that will override this value. Accepted values: true, false, 1, 0, yes, no
Example: random="yes"
randomSelect Type: String
Description: Whether or not the results will be randomly selected from the database. This is done independantly of the sorting. This makes it possible to randomly select some data and then sort that random data by a specific column. Accepted values = yes, no
Example: randomSelect="yes"
responseFormat Type: String
Description: Sets how the API response will be returned.
Values:
template - The default value. This tells the system to use a Content Template to build the API response.
ui - This is used if the data from the API call will used in the administration as a UI form component.  A Content Template will be used to structure the data correctly to build the form component HTML.
Example: responseFormat="ui"
sort Type: Array
Description: Array of layout keys and the direction to sort those keys. If this is not used then sortDirection and sortKey will be used * if they are set.
asc = Ascending order (A - Z or 1 - 10)
desc = Descending order (Z - A or 10 - 1)
Example: sort[layoutKey]='asc' sort[layoutKey2]='desc'
sortDirection Type: String
Description: The direction to sort. Allowed values are "asc" and "desc"
asc = Ascending order (A - Z or 1 - 10)
desc = Descending order (Z - A or 10 - 1)
Example: sortDirection="desc"
sortKey Type: String
Description: A single layout key to sort on. If you need to sort on multiple layout keys use the 'sort' parameter instead.
Example: sortKey="layoutKey"
startAt Type: Integer
Description: Where to start in the results. Defaults to 0.
Example: startAt="2"
templateId Type: Integer
Description: Required if responseFormat is not 'data'. The id of the content template to use. If this is not passed when it's required then nothing will be returned.
Example: templateId="3"
unique Type: String
Description: Specifies whether or not the result should have unique values. This is really only useful if one layout key is returned for each item. Accepted values: true, false, 1, 0, yes, no
Example: unique="yes"