Method: Mailchimp::Campaigns#list
- Defined in:
- lib/mailchimp/api.rb
#list(filters = [], start = 0, limit = 25, sort_field = 'create_time', sort_dir = 'DESC') ⇒ Hash
Get the list of campaigns and their details matching the specified filters
Parameters:
-
filters
(Hash)
(defaults to: [])
—
a struct of filters to apply to this query - all are optional:
- String
-
campaign_id optional - return the campaign using a know campaign_id. Accepts multiples separated by commas when not using exact matching.
- String
-
parent_id optional - return the child campaigns using a known parent campaign_id. Accepts multiples separated by commas when not using exact matching.
- String
-
list_id optional - the list to send this campaign to - get lists using lists/list(). Accepts multiples separated by commas when not using exact matching.
- Int
-
folder_id optional - only show campaigns from this folder id - get folders using folders/list(). Accepts multiples separated by commas when not using exact matching.
- Int
-
template_id optional - only show campaigns using this template id - get templates using templates/list(). Accepts multiples separated by commas when not using exact matching.
- String
-
status optional - return campaigns of a specific status - one of “sent”, “save”, “paused”, “schedule”, “sending”. Accepts multiples separated by commas when not using exact matching.
- String
-
type optional - return campaigns of a specific type - one of “regular”, “plaintext”, “absplit”, “rss”, “auto”. Accepts multiples separated by commas when not using exact matching.
- String
-
from_name optional - only show campaigns that have this “From Name”
- String
-
from_email optional - only show campaigns that have this “Reply-to Email”
- String
-
title optional - only show campaigns that have this title
- String
-
subject optional - only show campaigns that have this subject
- String
-
sendtime_start optional - only show campaigns that have been sent since this date/time (in GMT) - - 24 hour format in <strong>GMT</strong>, eg “2013-12-30 20:30:00” - if this is invalid the whole call fails
- String
-
sendtime_end optional - only show campaigns that have been sent before this date/time (in GMT) - - 24 hour format in <strong>GMT</strong>, eg “2013-12-30 20:30:00” - if this is invalid the whole call fails
- Boolean
-
uses_segment - whether to return just campaigns with or without segments
- Boolean
-
exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true. Using this disables the use of any filters that accept multiples.
-
start
(Int)
(defaults to: 0)
—
optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)
-
limit
(Int)
(defaults to: 25)
—
optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
-
sort_field
(String)
(defaults to: 'create_time')
—
optional - one of “create_time”, “send_time”, “title”, “subject” . Invalid values will fall back on “create_time” - case insensitive.
-
sort_dir
(String)
(defaults to: 'DESC')
—
optional - “DESC” for descending (default), “ASC” for Ascending. Invalid values will fall back on “DESC” - case insensitive.
Returns:
-
(Hash)
—
containing a count of all matching campaigns, the specific ones for the current page, and any errors from the filters provided
- Int
-
total the total number of campaigns matching the filters passed in
- Array
-
data structs for each campaign being returned
- [String] id Campaign Id (used for all other campaign functions) - [Int] web_id The Campaign id used in our web app, allows you to create a link directly to it - [String] list_id The List used for this campaign - [Int] folder_id The Folder this campaign is in - [Int] template_id The Template this campaign uses - [String] content_type How the campaign's content is put together - one of 'template', 'html', 'url' - [String] title Title of the campaign - [String] type The type of campaign this is (regular,plaintext,absplit,rss,inspection,auto) - [String] create_time Creation time for the campaign - [String] send_time Send time for the campaign - also the scheduled time for scheduled campaigns. - [Int] emails_sent Number of emails email was sent to - [String] status Status of the given campaign (save,paused,schedule,sending,sent) - [String] from_name From name of the given campaign - [String] from_email Reply-to email of the given campaign - [String] subject Subject of the given campaign - [String] to_name Custom "To:" email string using merge variables - [String] archive_url Archive link for the given campaign - [Boolean] inline_css Whether or not the campaign content's css was auto-inlined - [String] analytics Either "google" if enabled or "N" if disabled - [String] analytics_tag The name/tag the campaign's links were tagged with if analytics were enabled. - [Boolean] authenticate Whether or not the campaign was authenticated - [Boolean] ecomm360 Whether or not ecomm360 tracking was appended to links - [Boolean] auto_tweet Whether or not the campaign was auto tweeted after sending - [String] auto_fb_post A comma delimited list of Facebook Profile/Page Ids the campaign was posted to after sending. If not used, blank. - [Boolean] auto_footer Whether or not the auto_footer was manually turned on - [Boolean] timewarp Whether or not the campaign used Timewarp - [String] timewarp_schedule The time, in GMT, that the Timewarp campaign is being sent. For A/B Split campaigns, this is blank and is instead in their schedule_a and schedule_b in the type_opts array - [String] parent_id the unique id of the parent campaign (currently only valid for rss children) - [String] tests_sent tests sent - [String] tests_remain test sends remaining - [Hash] tracking the various tracking options used - [Boolean] html_clicks whether or not tracking for html clicks was enabled. - [Boolean] text_clicks whether or not tracking for text clicks was enabled. - [Boolean] opens whether or not opens tracking was enabled. - [String] segment_text a string marked-up with HTML explaining the segment used for the campaign in plain English - [Array] segment_opts the segment used for the campaign - can be passed to campaigns/segment-test or campaigns/create() - [Hash] saved_segment if a saved segment was used (match+conditions returned above): - [Hash] id the saved segment id - [Hash] type the saved segment type - [Hash] name the saved segment name - [Hash] type_opts the type-specific options for the campaign - can be passed to campaigns/create() - [Int] comments_total total number of comments left on this campaign - [Int] comments_unread total number of unread comments for this campaign based on the login the apikey belongs to - [Hash] summary if available, the basic aggregate stats returned by reports/summary- Array
-
errors structs of any errors found while loading lists - usually just from providing invalid list ids
- [String] filter the filter that caused the failure - [String] value the filter value that caused the failure - [Int] code the error code - [Int] error the error message
1547 1548 1549 1550 |
# File 'lib/mailchimp/api.rb', line 1547 def list(filters=[], start=0, limit=25, sort_field='create_time', sort_dir='DESC') _params = {:filters => filters, :start => start, :limit => limit, :sort_field => sort_field, :sort_dir => sort_dir} return @master.call 'campaigns/list', _params end |