Campaign.Send
Schedules an existing campaign for sending.
The campaign must be imported with defined recipients. The user must have sufficient credits or their credit card details saved within the application for the campaign to be sent via the API.
Samples
While we don't have any samples for this particular method, we do have a number of samples in .NET, PHP, Classic ASP, Flash, Perl and Cold Fusion that can be easily adapted to use this method.
Parameters and required information
Here's a list of all the parameters you'll need to pass to the Campaign.Send method. All of the parameters are required unless otherwise noted.
ApiKey- Your API application key. See here for more details.
CampaignID- The ID of the campaign to send. This ID is returned by the Campaign.Create method.
Confirmation Email Address- The email address that the confirmation email that the campaign has been sent, will go to.
Delivery Date- The date the campaign should be scheduled to be sent. To send a campaign immediately pass in "Immediately". This date should be in the users timezone and formatted as YYYY-MM-DD HH:MM:SS.
Return Codes
Success
0: Success- The campaign was successfully scheduled for sending.
Error
5: Invalid Date- The Send Date provided was invalid.
100: Invalid API Key- The API key passed was not valid or has expired.
330: Invalid CampaignID- The CampaignID value passed in was not valid or does not exist.
331: Campaign has already been sent- The campaign has already been sent.
332: No Recipients Added- You must first add recipients to your campaign before you can send it.
333: Less than 6 Recipients in the Campaign- You must be sending to at least 6 recipients to use the API.
334: Campaign Pending Approval- Due to an increase in recipients this campaign needs to be approved before it can be sent. Please login to the application to complete the approval form.
335: Payment Details Required- You must have sufficient credits or your payment details saved within the application before you can send via the API.
336: Campaign Payment Failed- This campaign could not be sent because you card was rejected by the payment gateway.
337: Delivery Date Cannot be in the Past- The delivery date you specified must either be the current date to send campaigns immediately, or a date in the future.
SOAP 1.1
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx HTTP/1.1 Host: app.campaignmonitor.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://app.campaignmonitor.com/api/Campaign.Send" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Campaign.Send xmlns="http://app.campaignmonitor.com/api/"> <ApiKey>string</ApiKey> <CampaignID>int</CampaignID> <ConfirmationEmail>string</ConfirmationEmail> <SendDate>string</SendDate> </Campaign.Send> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Campaign.SendResponse xmlns="http://app.campaignmonitor.com/api/"> <Campaign.SendResult> <Code>int</Code> <Message>string</Message> </Campaign.SendResult> </Campaign.SendResponse> </soap:Body> </soap:Envelope>
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /api/api.asmx/Campaign.Send?ApiKey=string&CampaignID=string&ConfirmationEmail=string&SendDate=string HTTP/1.1 Host: app.campaignmonitor.com
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <Result xmlns="http://app.campaignmonitor.com/api/"> <Code>int</Code> <Message>string</Message> </Result>
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx/Campaign.Send HTTP/1.1 Host: app.campaignmonitor.com Content-Type: application/x-www-form-urlencoded Content-Length: length ApiKey=string&CampaignID=string&ConfirmationEmail=string&SendDate=string
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <Result xmlns="http://app.campaignmonitor.com/api/"> <Code>int</Code> <Message>string</Message> </Result>