API
Schedule
This example shows how you can schedule a newsletter for sending.
Parameters
| Field | Type | Description | Required / Optional |
|---|---|---|---|
username | string | The username used to log in to MailCamp. | Required |
usertoken | string | The unique token assigned to the user named above. | Required |
requesttype | string | The name of the relevant API file. | Required |
requestmethod | string | The name of the function being called. | Required |
responsetype | string | The format of the response. This can be 'xml' or 'json'. | Optional |
details | See the fields below. | Required | |
details.jobtype | string | The type of action being scheduled. In this case a send (send). | Required |
details.jobstatus | string | The status of the send. Possible values (w = waiting, p = paused, i = in progress, c = completed). In this case always use 'w' | Required |
details.when | int | Unix timestamp of the moment of sending | Required |
details.lists | int | The ID of the mailing list to send to. | Required |
responsetype | string | The format of the response. This can be 'xml' or 'json'. | Optional |
details | See the fields below. | Required | |
details.NewsletterChosen | int | The ID of the newsletter to be sent. | Required |
details.Lists | int | The ID of the mailing list to send to. | Required |
SendCriteria | See the fields below. | Required | |
SendCriteria.Confirmed | boolean | The confirmation status of the contacts being sent to; 'Confirmed' or 'unconfirmed', i.e. 1 or 0. | Required |
SendCriteria.Status | string | The status of the contacts being sent to. In this case only the active contacts (a), and not the unsubscribed or bounced contacts. | Required |
SendCriteria.List | int | The ID of the mailing list to send to. | Required |
SendCriteria.TagType | string | How tags are filtered. Possible values: AND (match all tags), OR (match specific tags) and NONE (none of these tags) | Optional |
SendCriteria.Tags | array | This is the array of tag IDs of all the tags to filter on. | Optional |
SendCriteria.SendSize | int | The number of contacts being sent to. You find this by first making an API call that calculates the number of subscribers that will be sent to. | Required |
SendCriteria.BackStep | boolean | Always leave this value at 1. | Required |
SendCriteria.Multipart | boolean | If the newsletter has both a text body and an HTML body, Multipart should be set to 1. | Required |
SendCriteria.TrackOpens | boolean | If the number of opened newsletters must be shown in the statistics, this value must be 1. | Required |
SendCriteria.TrackLinks | boolean | If the number of clicked links in newsletters must be shown in the statistics, this value must be 1. | Required |
SendCriteria.EmbedImages | boolean | As a rule you do not want to send images as attachments in the newsletter. This value is therefore 0. | Required |
SendCriteria.Newsletter | int | The ID of the newsletter that will be sent. | Required |
SendCriteria.SendFromName | string | The name of the sender of this send. | Required |
SendCriteria.SendFromEmail | string | The sender email address of this send. | Required |
SendCriteria.ReplyToEmail | string | The reply-to email address of this send. | Required |
SendCriteria.BounceEmail | string | The bounce email address of this send. This must be a unique address that is used only for reading out the bounced email. | Required |
SendCriteria.To_FirstName | int | The ID of the Custom Field in which the First name of the contact is stored. This is usually 2. | Required |
SendCriteria.To_Prefix | int | The ID of the Custom Field in which the Prefix (infix) of the contact's surname is stored. This is usually 3. | Required |
SendCriteria.To_LastName | int | The ID of the Custom Field in which the Last name of the contact is stored. This is usually 4. | Required |
SendCriteria.Charset | string | The character set is always UTF-8. | Required |
SendCriteria.NotifyOwner | boolean | Send a message to the list owner about this send. | Required |
SendCriteria.SendStartTime | int | Unix timestamp of the moment of sending. | Required |
SendCriteria.SendStartTime | int | Unix timestamp of the moment of sending. | Required |
SendCriteria.EmailResults | int | The elements success, failure and total must be set to 0. Any errors are logged here during sending. | Required |
SendCriteria.module_tracker_google_options_name | string | If the newsletter results must be tracked in Google Analytics, the Campaign Name can be specified here. | Required |
SendCriteria.module_tracker_google_options_source | string | If the newsletter results must be tracked in Google Analytics, the Campaign Source can be specified here. | Required |
fkid | int | The ID of the newsletter that will be sent. | Required |
fktype | string | The type of the send is newsletter (newsletter). | Required |
ownerid | int | The ID of the owner of the mailing list being sent to. | Required |
approved | int | If the send must first be approved by an admin, you can set this to 0. Default is 1. | Required |
Successful response
| Field | Type | Description |
|---|---|---|
status | string | The value of the status field is returned as “SUCCESS” on a successful response. |
data | int | If the statistics are found, the object is returned. |
Error response
| Field | Type | Description |
|---|---|---|
status | string | The value of the status field will be “FAILED”. |
errormessage | string | A text message explaining why the request failed. |
<xmlrequest>
<username>admin</username>
<usertoken>0123456789abcdef0123456789abcdef01234567</usertoken>
<requesttype>jobs</requesttype>
<requestmethod>Create</requestmethod>
<responsetype>xml</responsetype>
<details>
<jobtype>send</jobtype>
<jobstatus>w</jobstatus>
<when>1420596000</when>
<lists>10</lists>
<details>
<NewsletterChosen>99</NewsletterChosen>
<Lists>10</Lists>
<SendCriteria>
<Confirmed>1</Confirmed>
<Status>a</Status>
<List>10</List>
<TagType>AND</TagType>
<Tags>
<array>9</array>
<array>99</array>
<array>999</array>
</Tags>
</SendCriteria>
<SendSize>9999</SendSize>
<BackStep>1</BackStep>
<Multipart>1</Multipart>
<TrackOpens>1</TrackOpens>
<TrackLinks>1</TrackLinks>
<EmbedImages>0</EmbedImages>
<Newsletter>99</Newsletter>
<SendFromName>MailCamp</SendFromName>
<SendFromEmail>info@mailcamp.nl</SendFromEMail>
<ReplyToEmail>reply@mailcamp.nl</ReplyToEmail>
<BounceEmail>bounce@mailcamp.nl</BounceEmail>
<To_FirstName>2</To_FirstName>
<To_Prefix>3</To_Prefix>
<To_LastName>4</To_LastName>
<Charset>UTF-8</Charset>
<NotifyOwner>1</NotifyOwner>
<SendStartTime>1420596000</SendStartTime>
<EmailResults>
<success>0</success>
<total>0</total>
<failure>0</failure>
</EmailResults>
<module_tracker_google_options_name>Nieuwsbrief naam</module_tracker_google_options_name>
<module_tracker_google_options_source>MailingList</module_tracker_google_options_source>
</details>
<fkid>99</fkid>
<fktype>newsletter</fktype>
<ownerid>99</ownerid>
<approved>1</approved>
</details>
</xmlrequest>