Campaigns – operating a campaign

Sending campaigns

Call: POST /rest/campaigns/edit

Data in POST:

id_hash Required Hash of campaign to be edited
name Optional Campaign name
url Optional Address from which HTML code should be downloaded
html Optional HTML content of email
text Optional Text content of email
subject Optional Subject of email to be sent. Campaign name used by default.
from_address Optional “From” field, system address used by default.
from_name Optional “Sender” field, system name used by default.
reply_to Optional “Reply to” field, system address used by default.
list Optional Subscriber hash lists to which campaign should be sent. Can be in the form of a table if campaign is sent to more than one list.
group Optional Hash group to which campaign should be sent. Can be in the form of a table if campaign is sent to more than one list.
resignlink Optional URL address to which resignation requests should be directed.

Error codes:

1750 No campaign to edit under given hash
1751 Campaign already sent, modification not possible

Other error codes are the same as in the campaign creation process.

Deleting campaigns

Call: POST /rest/campaigns/delete

Data in POST:

hash Required Hash of campaign to be deleted

 

Error codes::

1724 No campaign with given hash
1798 Campaign has already been deleted

Sending text campaigns

Call: POST /rest/campaigns/sendTest

Data in POST:

hash Required Hash of campaign to be sent
emails Required Address or table of addresses to be sent
custom_fields Optional Table of additional fields, default is random data from subscriber list

Sample commands:

{"hash":"campaign_hash",
"emails":"test@test.com",
"custom_fields":{
"name":"John",
"surname":"Down"}}

or

{"hash":"hash_campaign",
"emails":["test1@test.com","test2@test.com"]}

 

Error codes::

1721 No hash or hash in wrong format
1722 No email address
1723 Error in at least one address
1724 Campaign with given hash doesn’t exist
1725 Campaign not ready for testing
1726 Sending failed

Sending campaigns

Call: POST /rest/campaigns/send

Data in POST:

hash Required Hash of campaign to be sent
time Optional Date of campaign sending in format YYYY-MM-DD H:i:s


Error codes:
:

1731 No hash or hash is in incorrect format
1732 Sending time is incorrect
1733 Sending time cannot be earlier than present time
1734 No campaign with given hash
1735 Campaign not ready for testing
1736 Campaign already finalised for sending or in process of being sent