Fetch Campaigns using filters
/rest/api/v1.3/campaigns/actions/search
Request
- application/x-www-form-urlencoded
-
limit: integer
Number of campaigns to return in the response (defaults to 20 and cannot exceed 20)
-
offset: integer
Starts at 0 and indicates the record number for the response result set
object
searchCampaigns-request
-
filterCriteria(optional):
object filterCriteria
Filter Criteria section. Maximum of 2 filter criterias can be passed per API call
-
searchCriteria(optional):
object searchCriteria
Search Criteria section.
-
sortCriteria(optional):
object sortCriteria
Sort Criteria section. This section is optional. If no sorting is provided, by default ModifiedOn and descending order will be considered
object
-
campaignPurpose(optional):
array campaignPurpose
Campaign Purpose. Allowed campaign purposed are Transactional and Promotional. Multiple campaign purposes can be passed
-
campaignStatus(optional):
array campaignStatus
Campaign Status. Allowed campaign status are active, closed, draft and scheduled. Multiple campaign types can be passed
-
campaignType(optional):
array campaignType
Campaign Types. Allowed campaign types are email, sms, mms, inapp, push and webpush. Campaign Types will be allowed on the access to that particular account. Multiple campaigns types can be passed.
-
createdBy(optional):
string
Created By. A valid single user name should be passed. All the campaigns created by this user will be returned
-
createdOn(optional):
string
Created On Date should be in MM-dd-yyyy format. Maximum limit of 90 days. All the campaigns created from the given date till today's date range will be returned
-
filter(optional):
string
Filter. A valid single filter name should be passed. Filter is always associated with Profile List. So if the filter attribute is passed it is mandate to pass the profile list name as well
-
folderName(optional):
string
Folder name. A valid single folder name should be passed. All the campaigns part of this folder will be returned
-
marketingProgram(optional):
string
Marketing Program. A valid single value must be passed. All the campaigns with this marketing program will be returned
-
marketingStrategy(optional):
string
Marketing Strategy. A valid single value must be passed. All the campaigns with this marketing strategy will be returned
-
mobileCampaignTemplate(optional):
string
Mobile Campaign Template. A valid single mobile template name should be passed. This attribute has to be passed along with the campaign Type as sms or mms. Allowed values are Broadcast, EmailAcquisition, Custom, SmsOptIn, SmsOptOut, TextForResponse, SmsNotification, TextForCustomerCare, DirectAPINotification, LMS
-
modifiedBy(optional):
string
Modified By. A valid single user name should be passed. All the campaigns modified by this user will be returned
-
modifiedOn(optional):
string
Modified On Date should be in MM-dd-yyyy format. Maximum limit of 90 days. All the campaigns modified from the given date till today's date range will be returned
-
profileList(optional):
string
Profile List. A valid single profile list name should be passed. All the campaigns with this profile list will be returned
-
shortCodeAndLongCode(optional):
string
Short-Long code. A valid single value must be passed. This attribute has to be passed along with the campaign Type as sms or mms. All the campaigns with this short-long code will be returned
object
-
keyword(optional):
object keyword
keyword contains the key-value pair for passing the keyword to be searched in all campaigns
object
-
field(optional):
string
Sorting field. Field on which sorting should be done. A single field value should be passed. Allowed values are campaignName,campaignType,campaignStatus,channelType,modifiedBy,modifiedOn,createdBy and createdOn
-
order(optional):
string
Sorting order. It can be asc for ascending or desc for descending
array
array
array
object
-
key(optional):
string
The type of search has to be mentioned in the key. Currently the API supports campaignName.
-
value(optional):
string
The keyword that needs to be matched in all campaigns and return all the campaigns whose name and description contains this keyword.
Response
- application/json
Default Response
array
-
Array of:
object searchCampaigns-response
Title:
searchCampaigns-response
Examples
Use this API to fetch campaigns using a combination of search criteria to filter.
FIELDS | DESCRIPTION |
---|---|
Authorization | <AUTH_TOKEN> |
Content-Type | application/json |
Example
Retrieve the first 5 campaigns in my database that have "Summer" in the campaign name, where the campaign type is Email, the campaign status is "active", the campaign purpose is "Promotional", in descending order by campaign name.
Sample Request:
/rest/api/v1.3/campaigns/actions/search?offset=0&limit=5
Sample Request Body:
{ "searchCriteria": { "keyword": { "key": "campaignName", "value": "Summer" } }, "filterCriteria": { "campaignType": "EMAIL", "campaignStatus": "ACTIVE", "campaignPurpose": "PROMOTIONAL" }, "sortCriteria": { "field": "campaignName", "order": "desc" } }
Sample Response: Success
{ "campaigns": [ { "id": 1000, "name": "testcampaign-Summer", "folderName": "testfolder", "type": "EMAIL", "campaignStatus": "ACTIVE", "isScheduled": false, "description": "description", "purpose": "PROMOTIONAL", "marketingStrategy": "strategy", "marketingProgram": "program", "listName": "listname", "filterPaths": [ "foldername/objectName1", "foldername/objectName2" ], "refiningDataSourcePath": "foldername/objectName1", "proofListPath": "foldername/objectName1", "seedListPath": "foldername/objectName1", "segmentPaths": [ "foldername/objectName1", "foldername/objectName2" ], "supplementaryCampaignDataSourcePaths": [ "foldername/objectName1", "foldername/objectName2" ], "supplementaryLookupDataSourcePaths"[ "foldername/objectName1", "foldername/objectName2" ], "supplementaryProofDataSourcePaths": [ "foldername/objectName1", "foldername/objectName2" ], "supplementarySeedDataSourcePaths": [ "foldername/objectName1", "foldername/objectName2" ], "suppressionListPaths": [ "foldername/objectName1", "foldername/objectName2" ], "subject": "subject", "fromName": "from name", "fromEmail": "from email", "replyToEmail": "reply to email", "bccEmail": "bcc email", "htmlMessagePath": "documentPath", "textMessagePath": "documentPath", "enableExternalTracking": true, "externalTrackingParams": { "name1": "value1", "name2": "value2" }, "enableLinkTracking": true, "linkTablePath": "foldername/objectName1", "attachmentPaths": [ "documentPath1", "documentPath2" ], "campaignVariables": { "name1": "value1", "name2": "value2" }, "useUTF8": true, "locale": "value", "trackHTMLOpens": true, "trackConversions": true, "sendTextIfHTMLUnknown": true, "segmentTrackingColumnName": "name", "unsubscribeOption": "OPTOUT_SINGLE_CLICK", "unsubscribeFormName": "name", "autoCloseOption": "NO_AUTO_CLOSE", "autoCloseValue": "value", "closedCampaignURL": "URL", "externalCampaignCode": "code", "salesForceCampaignId": "salesforce id", "links": [ { "rel": "self", "href": "/rest/api/v1.3/campaigns/testcampaign-b11", "method": "GET" }, { "rel": "create", "href": "/rest/api/v1.3/campaigns", "method": "POST" }, { "rel": "updateCampaign", "href": "rest/api/v1.3/campaigns/testcampaign-b11", "method": "PUT" } ] } ], "links": [ { "rel": "self", "href": "/rest/api/v1.3/campaigns?type=email", "method": "GET" }, { "rel": "prev", "href": "/rest/api/v1.3/campaigns?limit=200&offset=0&type=email", "method": "GET" }, { "rel": "next", "href": "rest/api/v1.3/campaigns?limit=200&offset=200&type=email", "method": "GET" } ] }
Troubleshooting Failures
If the searchCriteria
keyword
key
value is less than 3 characters, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Min Length of search keyword allowed: 3", "errorDetails": [] }
If the searchCriteria
keyword
key
value is more than 50 characters, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Max Length of search keyword allowed: 50", "errorDetails": [] }
Requests fail when an invalid character is passed for the key value, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid characters in the search Keyword", "errorDetails": [] }
Requests fail when more than 2 filters are specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Maximum number of filter criterias allowed: 2", "errorDetails": [] }
Requests fail when an invalid campaignType is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Campaign Type. Allowed values for this account: [email, push, inapp, webpush, sms, mms]", "errorDetails": [] }
Requests fail when an invalid campaign status is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Status. Allowed values for this account: [active, closed, draft, scheduled]", "errorDetails": [] }
Requests fail when an invalid createdBy is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Created By: test123", "errorDetails": [] }
Requests fail when an invalid createdOn date format is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "CreatedOn Date is not in valid date format: MM-dd-yyyy", "errorDetails": [] }
Requests fail when a date in the future is specified for createdOn, the response resembles:
{ "type": "", "title": "Invalid date", "errorCode": "INVALID_DATE", "detail": "12-12-2020 Futuristic date is not allowed", "errorDetails": [] }
Requests fail when an invalid modifiedBy date is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Modified By: test123", "errorDetails": [] }
Requests fail when an invalid modifiedOn date is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "ModifiedOn Date is not in valid date format: MM-dd-yyyy", "errorDetails": [] }
Requests fail when a date in the future is specified for modifiedOn, the response resembles:
{ "type": "", "title": "Invalid date", "errorCode": "INVALID_DATE", "detail": "12-12-2020 Futuristic date is not allowed", "errorDetails": [] }
Requests fail when an invalid modifiedOn date format is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "ModifiedOn Date is not in valid date format: MM-dd-yyyy", "errorDetails": [] }
Requests fail when the specified listName contains an invalid character, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid characters in the List Name", "errorDetails": [] }
Requests fail when the specified list does not exist, the response resembles:
{ "type": "", "title": "List not found", "errorCode": "LIST_NOT_FOUND", "detail": "Profile List: TestList not found", "errorDetails": [] }
Requests fail when the specified folderName contains an invalid character, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid characters in the Folder Name", "errorDetails": [] }
Requests fail when the specified folder does not exist, the response resembles:
{ "type": "", "title": "Folder not found", "errorCode": "FOLDER_NOT_FOUND", "detail": "The Folder MonthlyPromotions is not found", "errorDetails": [] }
Requests fail when a non-existant filter is applied, the response resembles:
{ "type": "", "title": "Filter not found", "errorCode": "FILTER_NOT_FOUND", "detail": "Filter: CNN_10000w not found", "errorDetails": [] }
Requests fail when a valid filter is specified with a non-existing list, the response resembles:
{ "type": "", "title": "List not found", "errorCode": "LIST_NOT_FOUND", "detail": "Profile List: LIST_100001 not found", "errorDetails": [] }
Requests fail when an invalid campaignPurpose is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Campaign Purpose. Allowed values for this account: [Promotional, Transactional]", "errorDetails": [] }
Requests fail when an invalid marketingStrategy is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Marketing Strategy invalid not found", "errorDetails": [] }
Requests fail when an invalid marketingProgram is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Marketing Program invalid not found", "errorDetails": [] }
Requests fail when an invalid campaignTemplate is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Mobile Campaign Template: wss. Allowed Templates for this account are: [Broadcast, EmailAcquisition, Custom, SmsOptIn, SmsOptOut, TextForResponse, SmsNotification, TextForCustomerCare, DirectAPINotification, LMS]", "errorDetails": [] }
Requests fail when an invalid longCode or shortCode is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid shortCode/LongCode: 123", "errorDetails": [] }
There is no error message when an invalid sort field is provided and the deafault modifiedOn with desc is considered. However, there will be an error.
Requests fail when an invalid sort type is specified, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Sort Order Criteria. Allowed Sort Orders are: asc or desc", "errorDetails": [] }
Requests fail when a filter is passed without a profileList in the filterCriteria, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Filter: mN_TEST should always be associated along with the Profile List. Please provide a valid Profile List", "errorDetails": [] }
Requests fail when the campaignType is email, push, webpush, or inapp and mobileCampaignTemplate is passed in filterCriteria, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Mobile Campaign Templates are allowed only for SMS and MMS Campaigns", "errorDetails": [] }
Requests fail when the campaignType is email, push, webpush, or inapp and shortCodeAndLongCode is passed in filterCriteria, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Short and Long Code are allowed only for SMS and MMS Campaigns", "errorDetails": [] }
Requests fail when something other than campaignType is specfied while shortCodeAndLongCode is passed in filterCriteria, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Short and Long Code should be provided along with Campaign Type", "errorDetails": [] }
Requests fail when campaignPurpose is set to "Transactional" for an account set in the filterCriteria that does not have TransactionalCampaign enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Campaign Purpose. Allowed values for this account: [Promotional]", "errorDetails": [] }
Requests fail when campaignType is set to "SMS" for an account set in the filterCriteria that does not have SMS campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Campaign Type. Allowed values for this account: [email, push, inapp, mms]", "errorDetails": [] }
Requests fail when mobileCampaignTemplate is sent for account set in the filterCriteria that does not have SMS campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "This is not a SmsChannelEnabled account so Campaign Templates are not allowed for this account", "errorDetails": [] }
Requests fail when shortCodeAndLongCode is sent for account set in the filterCriteria that does not have SMS campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "This is not a SmsChannelEnabled account so Short and Long Code are not allowed for this account", "errorDetails": [] }
Requests fail when a mobileCampaignTemplate other than Broadcast, SmsOptOut, TextForResponse, or LMS is sent for account set in the filterCriteria that does not have SMS-Enterprise campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Mobile Campaign Template: DirectAPINotification. Allowed Templates for this account are: [Broadcast, SmsOptOut, TextForResponse, LMS]", "errorDetails": [] }
Requests fail when mobileCampaignTemplate is set to "LMS" for an account set in the filterCriteria that does not have LMS campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Mobile Campaign Template: LMS. Allowed Templates for this account are: [Broadcast, EmailAcquisition, Custom, SmsOptIn, SmsOptOut, TextForResponse, SmsNotification, TextForCustomerCare, DirectAPINotification]", "errorDetails": [] }
Requests fail when campaignType is set to "webpush" for an account set in the filterCriteria that does not have push campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "This is not a WebPushEnabled account so Campaign Type: WEBPUSH is not allowed for this account", "errorDetails": [] }
Requests fail when campaignType is set to "MMS" for an account set in the filterCriteria that does not have MMS campaigns enabled, the response resembles:
{ "type": "", "title": "Invalid request parameters", "errorCode": "INVALID_PARAMETER", "detail": "Invalid Campaign Type. Allowed values for this account: [email, push, inapp, sms]", "errorDetails": [] }
Requests failed when createdOn or modifiedOn date is more than 90 days in filterCriteria, the response resembles:
{ "type": "", "title": "Invalid date", "errorCode": "INVALID_DATE", "detail": "Maximum allowed Date limit is: 90 days", "errorDetails": [] }