com.createsend
Class Campaigns

java.lang.Object
  extended by com.createsend.CreateSendBase
      extended by com.createsend.Campaigns

public class Campaigns
extends CreateSendBase

Provides methods for accessing all Campaign resources in the Campaign Monitor API


Field Summary
 
Fields inherited from class com.createsend.CreateSendBase
jerseyClient, urlEncodingScheme
 
Constructor Summary
Campaigns(AuthenticationDetails auth)
          Constructor used to create new campaigns.
Campaigns(AuthenticationDetails auth, java.lang.String campaignID)
          Constructor used for working with existing campaigns.
 
Method Summary
 PagedResult<Subscriber> bounces()
          Gets a paged list of bounces for the specified campaign
 PagedResult<Subscriber> bounces(java.util.Date bouncesFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of bounces for the specified campaign
 PagedResult<Subscriber> bounces(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of bounces for the specified campaign
 PagedResult<CampaignClick> clicks()
          Gets a paged list of clicks for the specified campaign
 PagedResult<CampaignClick> clicks(java.util.Date clicksFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of clicks for the specified campaign
 PagedResult<CampaignClick> clicks(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of clicks for the specified campaign
 java.lang.String create(java.lang.String clientID, CampaignForCreation campaign)
          Creates a new campaign for the specified client based on the provided campaign data.
 java.lang.String createFromTemplate(java.lang.String clientID, CampaignForCreationFromTemplate campaign)
          Creates a new campaign for the specified client, based on the template and campaign data specified.
 void delete()
          Deletes the specified draft campaign
 EmailClient[] emailClientUsage()
          Gets the email clients that subscribers used to open the campaign
 java.lang.String getCampaignID()
          Gets the current campaign ID.
 ListsAndSegments listsAndSegments()
          Gets the lists and segments that a campaign is to be, or has been sent to.
 PagedResult<CampaignOpen> opens()
          Gets a paged list of opens for the specified campaign
 PagedResult<CampaignOpen> opens(java.util.Date opensFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of opens for the specified campaign
 PagedResult<CampaignOpen> opens(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of opens for the specified campaign
 PagedResult<Subscriber> recipients(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of recipients for the specified campaign
 void send(java.lang.String confirmationEmail, java.util.Date sendDate)
          Sends an existing draft campaign using the provided confirmation email and send date.
 void setCampaignID(java.lang.String campaignID)
          Sets the ID of the campaign to apply API calls to.
 PagedResult<Subscriber> spamComplaints()
          Gets a paged list of spam complaints for the specified campaign
 PagedResult<Subscriber> spamComplaints(java.util.Date spamComplaintsFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of spam complaints for the specified campaign
 PagedResult<Subscriber> spamComplaints(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of spam complaints for the specified campaign
 CampaignSummary summary()
          Get summary reporting data for the specified campaign
 void test(PreviewData data)
          Sends a preview of an existing draft campaign to the recipients specified in the preview data.
 void unschedule()
          Unschedules a campaign and moves it back to the drafts.
 PagedResult<Subscriber> unsubscribes()
          Gets a paged list of unsubscribes for the specified campaign
 PagedResult<Subscriber> unsubscribes(java.util.Date unsubscribesFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of unsubscribes for the specified campaign
 PagedResult<Subscriber> unsubscribes(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged list of unsubscribes for the specified campaign
 
Methods inherited from class com.createsend.CreateSendBase
refreshToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Campaigns

public Campaigns(AuthenticationDetails auth)
Constructor used to create new campaigns.

Parameters:
auth - The authentication details to use when making API calls. May be either an OAuthAuthenticationDetails or ApiKeyAuthenticationDetails instance.

Campaigns

public Campaigns(AuthenticationDetails auth,
                 java.lang.String campaignID)
Constructor used for working with existing campaigns.

Parameters:
auth - The authentication details to use when making API calls. May be either an OAuthAuthenticationDetails or ApiKeyAuthenticationDetails instance.
campaignID - The campaign ID to use when making API calls.
Method Detail

getCampaignID

public java.lang.String getCampaignID()
Gets the current campaign ID.

Returns:
The current campaign ID.

setCampaignID

public void setCampaignID(java.lang.String campaignID)
Sets the ID of the campaign to apply API calls to.

Parameters:
campaignID - The ID of the campaign to apply API calls to.

create

public java.lang.String create(java.lang.String clientID,
                               CampaignForCreation campaign)
                        throws CreateSendException
Creates a new campaign for the specified client based on the provided campaign data.

Parameters:
clientID - The ID of the client to create the campaign for
campaign - The campaign information used for the new campaign
Returns:
The ID of the newly created campaign
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Creating a campaign

createFromTemplate

public java.lang.String createFromTemplate(java.lang.String clientID,
                                           CampaignForCreationFromTemplate campaign)
                                    throws CreateSendException
Creates a new campaign for the specified client, based on the template and campaign data specified.

Parameters:
clientID - The ID of the client to create the campaign for
campaign - The campaign information used for the new campaign
Returns:
The ID of the newly created campaign
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Creating a campaign

send

public void send(java.lang.String confirmationEmail,
                 java.util.Date sendDate)
          throws CreateSendException
Sends an existing draft campaign using the provided confirmation email and send date. To schedule a campaign for immediate delivery use a null sendDate.

Parameters:
confirmationEmail - An email address to send the delivery confirmation to.
sendDate - The date to send the campaign at. This date should be in the clients timezone
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Sending a campaign

unschedule

public void unschedule()
                throws CreateSendException
Unschedules a campaign and moves it back to the drafts. If a campaign has already been sent or is in the process of sending, this api request will fail.

Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Sending a campaign

test

public void test(PreviewData data)
          throws CreateSendException
Sends a preview of an existing draft campaign to the recipients specified in the preview data.

Parameters:
data - The recipients and personalisation scheme to use for the preview
Throws:
CreateSendException - Raised when the API responds with a HTTP status >= 400
See Also:
Sending a campaign preview

summary

public CampaignSummary summary()
                        throws CreateSendException
Get summary reporting data for the specified campaign

Returns:
Summary reporting data for the specified campaign
Throws:
CreateSendException - Raised if the API responds with a HTTP Status >= 400

emailClientUsage

public EmailClient[] emailClientUsage()
                               throws CreateSendException
Gets the email clients that subscribers used to open the campaign

Returns:
Array of email clients used to open the specified campaign
Throws:
CreateSendException - Raised if the API responds with a HTTP Status >= 400

listsAndSegments

public ListsAndSegments listsAndSegments()
                                  throws CreateSendException
Gets the lists and segments that a campaign is to be, or has been sent to.

Returns:
The lists and segments that the campaign is to be, or has been sent to
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting lists and segments

recipients

public PagedResult<Subscriber> recipients(java.lang.Integer page,
                                          java.lang.Integer pageSize,
                                          java.lang.String orderField,
                                          java.lang.String orderDirection)
                                   throws CreateSendException
Gets a paged list of recipients for the specified campaign

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged recipients returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign recipients

bounces

public PagedResult<Subscriber> bounces()
                                throws CreateSendException
Gets a paged list of bounces for the specified campaign

Returns:
The paged bounces returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign bounces

bounces

public PagedResult<Subscriber> bounces(java.lang.Integer page,
                                       java.lang.Integer pageSize,
                                       java.lang.String orderField,
                                       java.lang.String orderDirection)
                                throws CreateSendException
Gets a paged list of bounces for the specified campaign

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged bounces returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign bounces

bounces

public PagedResult<Subscriber> bounces(java.util.Date bouncesFrom,
                                       java.lang.Integer page,
                                       java.lang.Integer pageSize,
                                       java.lang.String orderField,
                                       java.lang.String orderDirection)
                                throws CreateSendException
Gets a paged list of bounces for the specified campaign

Parameters:
bouncesFrom - The date to start getting bounce results from. This field is required
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged bounces returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign bounces

opens

public PagedResult<CampaignOpen> opens()
                                throws CreateSendException
Gets a paged list of opens for the specified campaign

Returns:
The paged opens returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign opens

opens

public PagedResult<CampaignOpen> opens(java.lang.Integer page,
                                       java.lang.Integer pageSize,
                                       java.lang.String orderField,
                                       java.lang.String orderDirection)
                                throws CreateSendException
Gets a paged list of opens for the specified campaign

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged opens returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign opens

opens

public PagedResult<CampaignOpen> opens(java.util.Date opensFrom,
                                       java.lang.Integer page,
                                       java.lang.Integer pageSize,
                                       java.lang.String orderField,
                                       java.lang.String orderDirection)
                                throws CreateSendException
Gets a paged list of opens for the specified campaign

Parameters:
opensFrom - The date to start getting open results from. This field is required
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged opens returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign opens

clicks

public PagedResult<CampaignClick> clicks()
                                  throws CreateSendException
Gets a paged list of clicks for the specified campaign

Returns:
The paged clicks returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign clicks

clicks

public PagedResult<CampaignClick> clicks(java.lang.Integer page,
                                         java.lang.Integer pageSize,
                                         java.lang.String orderField,
                                         java.lang.String orderDirection)
                                  throws CreateSendException
Gets a paged list of clicks for the specified campaign

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged clicks returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign clicks

clicks

public PagedResult<CampaignClick> clicks(java.util.Date clicksFrom,
                                         java.lang.Integer page,
                                         java.lang.Integer pageSize,
                                         java.lang.String orderField,
                                         java.lang.String orderDirection)
                                  throws CreateSendException
Gets a paged list of clicks for the specified campaign

Parameters:
clicksFrom - The date to start getting click results from. This field is required
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged clicks returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign clicks

unsubscribes

public PagedResult<Subscriber> unsubscribes()
                                     throws CreateSendException
Gets a paged list of unsubscribes for the specified campaign

Returns:
The paged unsubscribes returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign unsubscribes

unsubscribes

public PagedResult<Subscriber> unsubscribes(java.lang.Integer page,
                                            java.lang.Integer pageSize,
                                            java.lang.String orderField,
                                            java.lang.String orderDirection)
                                     throws CreateSendException
Gets a paged list of unsubscribes for the specified campaign

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged unsubscribes returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign unsubscribes

unsubscribes

public PagedResult<Subscriber> unsubscribes(java.util.Date unsubscribesFrom,
                                            java.lang.Integer page,
                                            java.lang.Integer pageSize,
                                            java.lang.String orderField,
                                            java.lang.String orderDirection)
                                     throws CreateSendException
Gets a paged list of unsubscribes for the specified campaign

Parameters:
unsubscribesFrom - The date to start getting unsubscribe results from. This field is required
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged unsubscribes returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting campaign unsubscribes

spamComplaints

public PagedResult<Subscriber> spamComplaints()
                                       throws CreateSendException
Gets a paged list of spam complaints for the specified campaign

Returns:
The paged spam complaints returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Campaign spam complaints

spamComplaints

public PagedResult<Subscriber> spamComplaints(java.lang.Integer page,
                                              java.lang.Integer pageSize,
                                              java.lang.String orderField,
                                              java.lang.String orderDirection)
                                       throws CreateSendException
Gets a paged list of spam complaints for the specified campaign

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged spam complaints returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Campaign spam complaints

spamComplaints

public PagedResult<Subscriber> spamComplaints(java.util.Date spamComplaintsFrom,
                                              java.lang.Integer page,
                                              java.lang.Integer pageSize,
                                              java.lang.String orderField,
                                              java.lang.String orderDirection)
                                       throws CreateSendException
Gets a paged list of spam complaints for the specified campaign

Parameters:
spamComplaintsFrom - The date to start getting spam complaints from. This field is required
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
The paged spam complaints returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Campaign spam complaints

delete

public void delete()
            throws CreateSendException
Deletes the specified draft campaign

Throws:
CreateSendException - Raised when the API responds with a HTTP status >= 400
See Also:
Deleting a campaign