Mailing Lists API
- Table of Contents
- Get a list of mailing lists
- Create a new mailing list
- Update an existing mailing list
- Deleting a mailing list
Get a list of mailing lists
Get a list of the basic details of all mailing lists in GreenArrow Studio.
URL
GET /ga/api/v2/mailing_lists
Request Parameters
This API method does not require any additional parameters.
Response
The response will be a JSON array where each element contains the following keys.
|
id
integer |
The |
||||||||||||
|
name
string |
The name of the mailing list |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The name of the default Virtual MTA for campaigns from this mailing list |
||||||||||||
|
d_ string |
The default URL Domain for campaigns from this mailing list |
||||||||||||
|
d_ integer |
The default speed for campaigns from this mailing list |
||||||||||||
|
d_ string |
The default Sender email address for campaigns from this mailing list |
||||||||||||
|
d_ string |
The default Bounce email address for campaigns from this mailing list. |
||||||||||||
|
d_ array of hashes |
The default seed lists for campaigns from this mailing list. This is an array of hashes with the |
||||||||||||
|
d_ boolean |
The default setting for automatic winner selection on new campaigns |
||||||||||||
|
d_ string |
The default percentage that will be sent for the split-test portion of the campaign (Note: This value is returned as a string to prevent floating-point conversion errors) |
||||||||||||
|
d_ integer |
The default number of units of time that the campaign will wait before finishing after a split-test. |
||||||||||||
|
d_ string |
The default unit used in calculating the delay duration. |
||||||||||||
|
d_ string |
The metric used to decide the winner. See Automatic Winner Selection Metrics for more information. |
||||||||||||
|
has_ boolean |
|
||||||||||||
|
has_ boolean |
|
||||||||||||
|
custom_ boolean |
|
||||||||||||
|
custom_ string |
The content of the custom headers that will be added to every email sent to this mailing list. |
||||||||||||
|
primary_ integer |
The custom field id of the primary key for the mailing list. If this value is |
||||||||||||
|
preview_ hash |
The custom field data, see example below. |
||||||||||||
|
is_ boolean |
|
||||||||||||
|
database_ integer |
The primary key of the database connection to use on this mailing list. |
||||||||||||
|
database_ integer |
The name of the database connection to use on this mailing list. |
||||||||||||
|
google_ hash The Google Analytics configuration.
|
|||||||||||||
- Note: This value is returned as a string to prevent floating-point
conversion errors. You may send this value as an Integer, Float or String.
Posting a value with more than two decimals will cause a validation error. Be
careful because IEEE floating point can not exactly represent some decimal
values. For example
94.85is represented as94.85000000000001which will cause a validation error if used here. You may want to print to a string using two decimal places of precision.
Preview Custom Field Data
The preview_custom_field_data key is filled with a hash.
{
"Custom Field Name": {
"name": "Custom Field Name",
"type": "text",
"value": "Bob Example"
},
"Next Custom Field": {
"name": "Next Custom Field",
"type": "select_multiple_checkboxes",
"value": [ "Red", "Blue" ]
}
}
Custom fields which have Preview Custom Field Data values and are not specified in
the preview_custom_field_data list, will remain with the same values. In other words:
the custom fields provided in preview_custom_field_data are merged in with the existing
Preview Custom Field Data custom fields.
Example
Note that the JSON response will not be “pretty formatted” as it is below.
GET /ga/api/v2/mailing_lists
HTTP/1.1 200 OK
{
"success": true,
"data": [
{
"id": 145,
"name": "Basic Mailing List",
"d_from_email": "[email protected]",
"d_from_name": "John Doe",
"d_reply_to": "[email protected]",
"d_virtual_mta": null,
"d_virtual_mta_id": null,
"d_url_domain": null,
"d_url_domain_id": null,
"d_speed": 0,
"d_sender_email": "[email protected]",
"d_bounce_email": null,
"d_bounce_email_id": null,
"d_seed_lists": [
],
"d_autowinner_enabled": false,
"d_autowinner_percentage": null,
"d_autowinner_delay_amount": null,
"d_autowinner_delay_unit": "minutes",
"d_autowinner_metric": null,
"has_format": false,
"has_confirmed": false,
"custom_headers_enabled": false,
"custom_headers": "",
"primary_key_custom_field_id": null,
"preview_custom_field_data": {
},
"is_remote_list": false,
"google_analytics": {
"enabled": false
}
},
{
"id": 146,
"name": "Complex Mailing List",
"d_from_email": "[email protected]",
"d_from_name": "John Doe",
"d_reply_to": "[email protected]",
"d_virtual_mta": "smtp1",
"d_virtual_mta_id": 17,
"d_url_domain": "example.com",
"d_url_domain_id": 1,
"d_speed": 1000000,
"d_sender_email": "[email protected]",
"d_bounce_email": "[email protected]",
"d_bounce_email_id": "5312@60212",
"d_seed_lists": [
{
"id": 14,
"name": "Monitor"
}
],
"d_autowinner_enabled": true,
"d_autowinner_percentage": "10.0",
"d_autowinner_delay_amount": 15,
"d_autowinner_delay_unit": "minutes",
"d_autowinner_metric": "opens_unique",
"has_format": true,
"has_confirmed": false,
"custom_headers_enabled": true,
"custom_headers": "X-Foo: bar\n",
"primary_key_custom_field_id": null,
"preview_custom_field_data": {
},
"is_remote_list": false,
"google_analytics": {
"enabled": true,
"tracking_id": "UA-123456789-11",
"source": "newsletter",
"restrict_to_domain_list": true,
"domain_list": [
"example.com",
"example.com"
]
}
}
],
"error_code": null,
"error_message": null
}
Create a new mailing list
URL
POST /ga/api/v2/mailing_lists
Request Parameters
This API method does not require any additional parameters.
Request Payload
The POST request should have a JSON document in its payload with the following keys.
|
mailing_ hash
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Note: This value is returned as a string to prevent floating-point
conversion errors. You may send this value as an Integer, Float or String.
Posting a value with more than two decimals will cause a validation error. Be
careful because IEEE floating point can not exactly represent some decimal
values. For example
94.85is represented as94.85000000000001which will cause a validation error if used here. You may want to print to a string using two decimal places of precision. -
Remote Lists may only be created on the System Organization.
Exactly one of
database_connection_idanddatabase_connection_namemay be provided. The database connection must be previously set up in GreenArrow Engine.
Response
A successful response will return the mailing list record using the format described in the “Get a list of mailing lists” section of the API.
A failure will return a standard error response with an explanation of what went wrong.
- Only one of
d_seed_list_idsandd_seed_list_namesshould be present in a single request.
Example
POST /ga/api/v2/mailing_lists
{
"mailing_list": {
"name": "My Mailing List"
}
}
HTTP/1.1 200 OK
{
"success": true,
"data": {
"id": 149,
"name": "My Mailing List",
"d_from_email": null,
"d_from_name": null,
"d_reply_to": null,
"d_virtual_mta": null,
"d_virtual_mta_id": null,
"d_url_domain": null,
"d_url_domain_id": null,
"d_speed": null,
"d_sender_email": null,
"d_bounce_email": null,
"d_bounce_email_id": null,
"d_seed_lists": [
],
"d_autowinner_enabled": false,
"d_autowinner_percentage": null,
"d_autowinner_delay_amount": null,
"d_autowinner_delay_unit": "minutes",
"d_autowinner_metric": null,
"has_format": false,
"has_confirmed": false,
"custom_headers_enabled": false,
"custom_headers": "",
"primary_key_custom_field_id": null,
"preview_custom_field_data": {
},
"is_remote_list": false,
"google_analytics": {
"enabled": false
}
},
"error_code": null,
"error_message": null
}
Update an existing mailing list
URL
PUT /ga/api/v2/mailing_lists/:mailing_list_id
Request Parameters
|
mailing_ integer |
The |
Request Payload
The PUT request should have a JSON document in its payload with all of the following keys.
|
name
string |
The name of the mailing list |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The name of the default Virtual MTA for campaigns from this mailing list |
||||||||||||
|
d_ string |
The default URL Domain for campaigns from this mailing list |
||||||||||||
|
d_ integer |
The default speed for campaigns from this mailing list |
||||||||||||
|
d_ string |
The default |
||||||||||||
|
d_ string |
The default Bounce email address for campaigns from this mailing list. d_seed_list_ids (array of integers: The default seed lists for campaigns from this mailing list. This is an array of integers that represent the IDs of the seed lists to use. |
||||||||||||
|
d_ array of strings |
The default seed lists for campaigns from this mailing list. This is an array of strings that represent the names of the seed lists to use. |
||||||||||||
|
d_ boolean |
The default setting for automatic winner selection on new campaigns |
||||||||||||
|
d_ string |
The default percentage that will be sent for the split-test portion of the campaign |
||||||||||||
|
d_ integer |
The default number of units of time that the campaign will wait before finishing after a split-test. |
||||||||||||
|
d_ string |
The default unit used in calculating the delay duration. |
||||||||||||
|
d_ string |
The default metric used to decide the winner. See the “Automatic Winner Selection Metrics” table for more information. |
||||||||||||
|
has_ boolean |
|
||||||||||||
|
has_ boolean |
|
||||||||||||
|
custom_ boolean |
|
||||||||||||
|
custom_ string |
The content of the custom headers that will be added to every email sent to this mailing list. |
||||||||||||
|
primary_ integer |
The custom field to use as this mailing list’s primary key. If this is |
||||||||||||
|
preview_ hash |
The custom field data, a hash that maps custom field names to values. |
||||||||||||
|
database_ integer |
The primary key of the database connection to use on this mailing list (See 2 below). |
||||||||||||
|
database_ integer |
The name of the database connection to use on this mailing list (See 2 below). |
||||||||||||
|
google_ hash The Google Analytics configuration.
|
|||||||||||||
- The
d_autowinner_percentagevalue is returned as a string to prevent floating-point conversion errors. You may send this value as an Integer, Float or String. Posting a value with more than 2 decimals will cause a validation error. Be careful because IEEE floating point can not exactly represent some decimal values. For example94.85is represented as94.85000000000001which will cause a validation error if used here. You may want to print to a string using two decimal places of precision. - Only one of
d_seed_list_idsandd_seed_list_namesshould be present in a single request. - Only one of
database_connection_idanddatabase_connection_nameshould be present in a single request. These fields may only be present if the mailing list was created withis_remote_listenabled.
Response
A successful response will return the subscriber record using the format described in the “Get subscriber details” section of the API.
A failure will return a standard error response with an explanation of what went wrong.
Example
PUT /ga/api/v2/mailing_lists/150
{
"mailing_list": {
"name": "My renamed mailing list"
}
}
HTTP/1.1 200 OK
{
"success": true,
"data": {
"id": 150,
"name": "My renamed mailing list",
"d_from_email": "[email protected]",
"d_from_name": "John Doe",
"d_reply_to": "[email protected]",
"d_virtual_mta": null,
"d_virtual_mta_id": null,
"d_url_domain": null,
"d_url_domain_id": null,
"d_speed": 0,
"d_sender_email": "[email protected]",
"d_bounce_email": null,
"d_bounce_email_id": null,
"d_seed_lists": [
],
"d_autowinner_enabled": false,
"d_autowinner_percentage": null,
"d_autowinner_delay_amount": null,
"d_autowinner_delay_unit": "minutes",
"d_autowinner_metric": null,
"has_format": false,
"has_confirmed": false,
"custom_headers_enabled": false,
"custom_headers": "",
"primary_key_custom_field_id": null,
"preview_custom_field_data": {
},
"is_remote_list": false,
"google_analytics": {
"enabled": false
}
},
"error_code": null,
"error_message": null
}
Deleting a mailing list
Deleting a mailing list is a two-step process:
- Request a
Delete Confirmation Code. This will generate a confirmation code that will be valid for 2 minutes. - Send the confirmation code back to the server.
We do this because deleting a mailing list is what we consider to be a major event. The following happens when a mailing list is deleted:
- All subscribers are deleted.
- All active/scheduled subscriber imports and exports are cancelled.
- All active/scheduled campaigns are cancelled.
- The mailing list’s database entry is marked as
deleted.
From that point forward, the mailing list will no longer appear in the user interface.
URL
To request the confirmation code:
GET /ga/api/v2/mailing_lists/:mailing_list_id/delete_confirmation_code
To confirm the deletion and start the deletion process:
DELETE /ga/api/v2/mailing_lists/:mailing_list_id/confirmed/:delete_confirmation_code
Response (Request Confirmation Code)
|
delete_ |
The token to send back to the server to confirm deletion of the specified mailing list. |
|
delete_ |
The time at which the included token will no longer be valid. |
Example
GET /ga/api/v2/mailing_lists/152/delete_confirmation_code
HTTP/1.1 200 OK
{
"success": true,
"data": {
"delete_confirmation_code": "52e54fcba031fdef04dd3fe75d0ecf3eb0bfaced:1580910582",
"delete_confirmation_expires_at": "3020-02-05T13:49:42Z"
},
"error_code": null,
"error_message": null
}
Response (Reply with Confirmation Code, Delete Mailing List)
An empty successful response to this request indicates that the mailing list has been marked as deleted and the data cleanup listed above has been done.
Example
DELETE /ga/api/v2/mailing_lists/154/confirmed/52e54fcba031fdef04dd3fe75d0ecf3eb0bfaced:1580910582
HTTP/1.1 200 OK
{
"success": true,
"data": null,
"error_code": null,
"error_message": null
}
Campaign Statistics
Retrieve aggregated campaign statistics for this mailing list.
If provided, the campaigns included in this aggregation can be filtered based upon when they started sending.
URL
GET /ga/api/v2/mailing_lists/:mailing_list_id/campaign_statistics
Request Parameters
|
started_ timestamp |
When this field is provided, only campaigns that started on or after the specified time will be included in the results. When this is not provided, the results will include campaigns dating back to when the mailing list was created. |
|
started_ timestamp |
When this field is provided, only campaigns that started before the specified time will be included in the results. When this is not provided, the results will include campaigns up to the current time. |
Response
|
aggregated_ hash
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example
GET /ga/api/v2/mailing_lists/178/campaign_statistics?started_at__end=1488299101&started_at__start=1364833800
HTTP/1.1 200 OK
{
"success": true,
"data": {
"sent_text": 0,
"sent_html": 5,
"sent_multipart": 0,
"bounces_total": 0,
"bounces_unique": 0,
"bounces_unique_hard": 0,
"bounces_unique_soft": 0,
"bounces_unique_other": 0,
"bounces_unique_local": 0,
"bounces_unique_remote": 0,
"clicks_total": 0,
"clicks_unique": 0,
"clicks_unique_by_link": 0,
"opens_total": 0,
"opens_unique": 0,
"scomps_total": 0,
"scomps_unique": 0,
"scomps_status_updated": 0,
"unsubs_total": 0,
"unsubs_unique": 0,
"unsubs_status_updated": 0,
"bounces_status_updated": 0,
"total_messages": 5,
"total_success": 5,
"total_failure": 0,
"total_failure_toolong": 0,
"skips_error": 0,
"skips_request": 0,
"bounces_unique_by_code": {
},
"messages_sent": 5,
"messages_html": 5,
"messages_text": 0,
"accepted": 5,
"accepted_rate": 1.0,
"in_queue": 0,
"in_queue_rate": 0.0,
"max_unique_activities": 0,
"open_rate": 0.0,
"open_ratio": 0.0,
"unopened": 5,
"duplicate_opens": 0,
"duplicate_clicks": 0,
"click_rate": 0.0,
"click_to_open_rate": 0.0,
"unclicked": 5,
"bounced": 0,
"duplicate_bounces": 0,
"unbounced": 5,
"bounce_rate": 0.0,
"bounce_rate_hard": 0.0,
"bounce_rate_soft": 0.0,
"bounce_rate_other": 0.0,
"bounce_local_rate": 0.0,
"duplicate_scomps": 0,
"scomp_rate": 0.0,
"duplicate_unsubs": 0,
"unsub_rate": 0.0
},
"error_code": null,
"error_message": null
}
