Subscribers – managing subscribers
The controller can be used to add and update subscriber data on subscriber lists.
Subscriber status codes
Description | Value | Explanation |
Active | 1 | Subscriber active, campaign may be sent |
Awaiting activation | 2 | Subscriber must click on activation link before being added to active list |
Inactive | 3 | Subscriber did not click on activation link in confirmation mail before expiration |
Resigned | 4 | Subscriber resigned from mailing list |
Soft bounce | 5 | Message bounced several times in a row from subscriber inbox (soft) with code (http://www.ietf.org/rfc/rfc1893.txt) |
Hard bounce | 8 | Message bounced several times in a row from subscriber inbox (hard) with code (http://www.ietf.org/rfc/rfc1893.txt) |
Adding subscribers
New subscribers can be added to a list or current subscribers can have their statuses changed.
Call: POST /rest/subscriber/add
Data in POST:
Required | Email address of subscriber | |
list | Required | Hash of subscriber list |
state | Optional | Status to be added to subscriber, “awaiting activation” by default |
confirm | Optional | If subscriber is to be send confirmation mail or not. Possible valued 0 or 1. With confirmation by default. Field is ignored (email not sent) if subscriber given any other status besides “Awaiting activation”. |
custom_fields | Optional | Table with additional fields and additional values in the form of {"tag personalisation field 1":"value", "tag personalisation field 2":"value"} |
Error codes:
1301 | Email address error |
1302 | Subscriber list does not exist |
1303 | One or more additional fields contains an error |
1304 | Subscriber already exists on this list and has Active or Awaiting Activation status |
1305 | Attempted addition of improper subscriber status |
Modifying subscriber data
Method of updating subscriber status and data
Call: POST /rest/subscriber/edit
Data in POST:
Required | Subscriber email address | |
list | Required | Subscription hash list |
state | Optional | Status to be added to subscriber, default is no changes |
custom_fields | Optional | Table with additional fields and values in format: {"tag personalised field 1":"value", "tag personalised field 2":"value"} |
Error codes:
1331 | Subscriber doesn’t exist |
1302 | Subscriber list or hash list doesn’t exist |
1305 | Attempt to add incorrect subscriber status |
Downloading subscriber data
Call: GET /rest/subscriber/get/[list]/[email]
Data in GET:
Required | Subscriber email address | |
list | Required | Hash list of subscribers |
Returned Data:
Subscriber email address | |
state | Subscriber status |
custom_fields | Number of subscribers sent to |
sent | Date of sent campaigns in format: yyyy-mm-dd hh:ii:ss |
Error codes:
1311 | Error in email address |
1312 | Subscriber list doesn’t exist |
Deleting subscribers
Removing subscribers from subscriber lists
Call: POST /rest/subscriber/delete
Data in POST:
Required | Subscriber email address | |
list | Required | Hash list of subscribers |
Error codes:
1321 | Address does not exist on this subscriber list |
1322 | Subscriber list or hash doesn’t exist |
Download subscriber action history
How to download subscriber action history.
To execute this action:
POST /rest/subscriber/getHistory
Data in POST:
required | Subscriber email address | ||
list | required | Subscriber list hash | |
limit | optional | Number of subscriber actions to download (default 10) |
Sample request:
{"email":"tester1@freshmail.com"
"list":"4zcnmd2ski"
"limit":"30"}
Received data:
name | Name of campaign | |
---|---|---|
email_topic | Subject of campaign | |
scheduled_sent | Date and time of sent campaign (in yyyy-mm-dd and hh-ii-ss format) | |
state | Subscriber status - deliveries, soft bounces, hard bounces | |
opens_count | Number of subscriber opens | |
clicks_count | Number of subscriber clicks |
Error codes:
1311 | Incorrect email address | |
---|---|---|
1312 | Subscriber list does not exist | |
1313 | Subscriber does not exist on given subscriber list | |
1314 | Attribute value limit is incorrect | |
1315 | Subscriber does not have an action |
Example of incorrect reply:
{"status":"ERROR",
"errors":[{
"message":"Subscriber doesn't exist",
"code":1313 }]}
Example of correct reply:
{"status":"OK", "data":[{ "name":"4 campaign sent on 30.07.2013", "email_topic":"Autumn promotion", "scheduled_sent":"2013-07-30 21:37:42", "state":"DELIVERED", "opens_count":"1", "clicks_count":"2" }]}
Downloading subscriber action history
Process for downloading recent subscriber actions.
Call: POST /rest/subscriber/getHistory
Data in POST:
Required | Subscriber email address | |
list | Required | Hash list of subscribers |
limit | Optional | Number of downloaded subscriber actions (default is 10) |
Example request:
{
"email":"tester1@freshmail.com"
"list":"4zcnmd2ski"
"limit":"30"
}
Returned Data:
name | Campaign name |
email_topic | Campaign subject |
scheduled_sent | Date and time of campaign (format: yyyy-mm-dd hh:ii:ss) |
state | Subscriber status (delivery, hard & soft bounces) |
opens_count | Number of opens by subscriber |
clicks_count | Number of clicks by subscriber |
Error codes:
1311 | Error in email address |
1312 | Subscriber list doesn’t exist |
1313 | Subscriber doesn’t exist on given list |
1314 | Value attribute limit is in incorrect |
1315 | Subscriber has no actions |
Sample incorrect reply:
{"status":"ERROR",
"errors":[{
"message":"Subscriber doesn't exist",
"code":1313
}]}
Sample correct reply:
{"status":"OK",
"data":[{
"name":"4 tuesday campaign 30.07.2013",
"email_topic":"Summer promotion",
"scheduled_sent":"2013-07-30 21:37:42",
"state":"DELIVERED",
"opens_count":"1",
"clicks_count":"2"
}]}