The enumerateEmailCampaigns() method provides a way to list email campaigns. By default campaign contents are not included in the listing unless the include_content argument is set.
There are several ways to restrict the output:
- To a set of particular statuses, provide those statuses in the statuses argument. Valid statuses are “active”, “deleted”, and “sent”.
- A list of campaign ids can also be provided to restrict the listing to a particular set.
- The limit and offset arguments can be used to specify a “window” of matching campaigns. By default, deleted campaigns will not be included in the result.
- Set the include_deleted argument to true if you want to see deleted campaigns.
The output of this method will contain two different types of status: “status” and “display_status”. You should use “display_status” if sharing that information with users; the “status” attribute includes cryptic internal messages like “csr_check”.
Display status values include:
- Active (still in draft mode)
- Pending Approval (in the queue to be approved by our campaign checkers)
- Pending Launch (approved but not yet launched)
- Sent
Input
[vrtypens:enumerateEmailCampaignsArgs]
session_id [xsd:string] (required)
Your API session id.
campaign_ids [vrtypens:ArrayOfInteger]
A list of campaign ids to restrict output to.
statuses [vrtypens:ArrayOfString]
A list of campaign statuses to restrict output to. If provided, only campaigns with these statuses are returned.
include_content [xsd:boolean]
Whether to include contents array for each campaign in output.
Warning: setting this to true when enumerating many campaigns can lead to very large responses.
Warning: setting this to true when enumerating many campaigns can lead to very large responses.
include_deleted [xsd:boolean]
Whether to include deleted campaigns in the output. By default deleted campaigns are not returned.
include_lists [xsd:boolean]
Whether to include info about lists attached to each campaign.
For each attached list, only the id, name, and size will be provided.
Asking for list info is not allowed unless the output is limited to 100 campaigns or less (either specifying 100 campaign ids or a limit of 100).
For each attached list, only the id, name, and size will be provided.
Asking for list info is not allowed unless the output is limited to 100 campaigns or less (either specifying 100 campaign ids or a limit of 100).
order_by_fields [vrtypens:ArrayOfOrderByField]
An array of fields and directions that specify an ordering for the returned campaigns.
limit [xsd:int]
The maximum number of records to return.
offset [xsd:int]
Only records on or beyond this index are included in the result.
Output
[vrtypens:ArrayOfEmailCampaign]
Examples
PHP
$vrapi->enumerateEmailCampaigns( array( 'session_id' => $sid, 'limit' => 2, 'order_by_fields' => array( array( 'field_name' => 'last_updated', 'direction' => 'asc', ), array( 'field_name' => 'mail_date', 'direction' => 'asc', ), ), ) );
Ruby
vr.enumerateEmailCampaigns({ 'session_id' => sid, 'limit' => 2, 'order_by_fields' => [ { 'field_name' => 'last_updated', 'direction' => 'asc', }, { 'field_name' => 'mail_date', 'direction' => 'asc', }, ], })
Java
OrderByField[] orderByField = new OrderByField[2]; orderByField[0] = new OrderByField ("last_updated", "asc"); orderByField[1] = new OrderByField ("mail_date", "asc"); EnumerateEmailCampaignsArgs enumerateEmailCampaignsArgs = new EnumerateEmailCampaignsArgs(); enumerateEmailCampaignsArgs.setSession_id(sessionID); enumerateEmailCampaignsArgs.setLimit(2); enumerateEmailCampaignsArgs.setOrder_by_fields(orderByField); vr.enumerateEmailCampaigns(enumerateEmailCampaignsArgs);
C#/.NET
OrderByField[] orderByField = new OrderByField[2]; orderByField[0] = new OrderByField(); orderByField[0].field_name = "last_updated"; orderByField[0].direction = "asc"; orderByField[1] = new OrderByField(); orderByField[1].field_name = "mail_date"; orderByField[1].direction = "asc"; enumerateEmailCampaignsArgs eECA = new enumerateEmailCampaignsArgs(); eECA.session_id = sessionId; eECA.limitSpecified = true; eECA.limit = 2; eECA.order_by_fields = orderByField; //eECA.include_contentSpecified = true; //eECA.include_content = true; try { objVR.enumerateEmailCampaigns(eECA); } catch (Exception e) { System.Console.WriteLine(e.Message); }
Perl
$vrapi->enumerateEmailCampaigns( { session_id => $sid, limit => 2, order_by_fields => [ { field_name => 'last_updated', direction => 'asc', }, { field_name => 'mail_date', direction => 'asc', }, ], } );