Campaign management resource¶
List campaigns¶
The resource results can be filtered using the optional querystring parameters:
filter: -
all, campaign, transactional
default allstate_filter
all, new, scheduled, sending, sent, cancelled
default allcontact_list_filter:
all, $contactlist_id
default allorderby:
name, cdate, total, opened, openedratio, clicked, clickedratio
default cdateoffset default:0
limit default:20
Request:
GET /campaigns
Response
{
"campaign": [
{
"campaign_id",
"name",
"cdate",
"mdate",
"autocreated",
"state",
"body_html",
"schedule",
"archived"
],
"total": 2,
}
Create campaign¶
Request
POST /create campaign
{
string:name*,
string:subject*,
string:sender_email*,
string:sender_name,
string:replyto,
int:contactlist_id*,
int:segment_id (default 0),
bool:ga_tracking (default: false),
string:personalize_to,
string/text:body_html,
int:template_id
}
Note
Properties marked with * are mandatory and can’t be empty
Response
{
"status",
"id"
}
Get campaign by id¶
Request:
GET /campaigns/{campaign_id}
Response
{
"campaign": {
"campaign_id",
"name",
"cdate",
"mdate",
"autocreated",
"subject",
"sender_name",
"replyto",
"schedule",
"state",
"archived",
"contactlist_id",
"segment_id",
"ga_tracking",
"personalize_to",
"contactlist_name",
"sender_email"
}
}
Update campaign¶
Request
POST /campaigns/{campaign_id}
{
string:name*,
string:subject*,
string:sender_email*,
string:sender_name,
string:replyto,
int:contactlist_id*,
int:segment_id (default 0),
bool:ga_tracking (default: false),
string:personalize_to,
string/text:body_html,
int:template_id
}
Note
Properties marked with ** can’t be empty if modified
A campaign can be updated ONLY IF it’s status is ‘new’ (meaning that the requested campaign wasn’t started)
Response
{
"status"
}
Schedule campaign¶
Request
POST /campaigns/schedule/{campaign_id}
{
date:datetime
}
Response
{
"status"
}
Unschedule previously scheduled campaign¶
Request:
DELETE: /campaigns/schedule/{campaign_id}
Response
{
"status"
}
Send campaign test email¶
Request
POST: /campaigns/test/{campaign_id}
{
string:addresses (separated by comma)
}
Response
{
"status"
}
Send campaign¶
Request:
POST: /campaigns/send/{campaign_id}
Response
{
"status"
}
Archive campaign¶
Request:
POST: /campaigns/archive/{campaign_id}
Response
{
"status"
}
Unarchive campaign¶
Request:
DELETE: /campaigns/archive/{campaign_id}
Response
{
"status"
}
Ready to send campaign¶
Request:
GET: /campaigns/ready/{campaign_id}
Response
{
"status"
}
- Status::
ok
editing_no_longer_allowed
campaign_no_unsublink
campaign_bad_rating
campaign_sending_disabled
not_enough_credits
zero_contacts
Duplicate campaign¶
Request:
POST: /campaigns/duplicate/{campaign_id}
Response
{
"status",
"new_id"
}
Get campaign content¶
Request:
GET: /campaigns/content/{campaign_id}
Response
{
"body_text",
"body_html"
}
Errors:¶
denied (401) - you do not have access to that resource
error (500) - server error
bad_request (400) - required data was not sent
not_found (404) - resource not found
Error codes:¶
200: success
201: request has ben fulfilled, new resource created
400: request cannot be fulfilled due to bad syntax (one ore more arguments are missing or midpelling)
401: not alowed here
403: the server understood the request, but is refusing to fulfill it (reason in response status)
404: Resource not found
500: Server error