Skip to content

Files

Latest commit

author
ElasticEmail
Dec 5, 2024
642df73 · Dec 5, 2024

History

History
329 lines (228 loc) · 9.58 KB

CampaignsApi.md

File metadata and controls

329 lines (228 loc) · 9.58 KB

ElasticEmail::CampaignsApi

Load the API package

use ElasticEmail::Object::CampaignsApi;

All URIs are relative to https://api.elasticemail.com/v4

Method HTTP request Description
campaigns_by_name_delete DELETE /campaigns/{name} Delete Campaign
campaigns_by_name_get GET /campaigns/{name} Load Campaign
campaigns_by_name_pause_put PUT /campaigns/{name}/pause Pause Campaign
campaigns_by_name_put PUT /campaigns/{name} Update Campaign
campaigns_get GET /campaigns Load Campaigns
campaigns_post POST /campaigns Add Campaign

campaigns_by_name_delete

campaigns_by_name_delete(name => $name)

Delete Campaign

Delete the specific campaign. This does not cancel in progress email, see Cancel In Progress. Required Access Level: ModifyCampaigns

Example

use Data::Dumper;
use ElasticEmail::CampaignsApi;
my $api_instance = ElasticEmail::CampaignsApi->new(

    # Configure API key authorization: apikey
    api_key => {'X-ElasticEmail-ApiKey' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'X-ElasticEmail-ApiKey' => 'Bearer'},
);

my $name = "name_example"; # string | Name of Campaign to delete

eval {
    $api_instance->campaigns_by_name_delete(name => $name);
};
if ($@) {
    warn "Exception when calling CampaignsApi->campaigns_by_name_delete: $@\n";
}

Parameters

Name Type Description Notes
name string Name of Campaign to delete

Return type

void (empty response body)

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

campaigns_by_name_get

Campaign campaigns_by_name_get(name => $name)

Load Campaign

Returns the specified campaign details. Required Access Level: ViewCampaigns

Example

use Data::Dumper;
use ElasticEmail::CampaignsApi;
my $api_instance = ElasticEmail::CampaignsApi->new(

    # Configure API key authorization: apikey
    api_key => {'X-ElasticEmail-ApiKey' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'X-ElasticEmail-ApiKey' => 'Bearer'},
);

my $name = "name_example"; # string | Name of Campaign to get

eval {
    my $result = $api_instance->campaigns_by_name_get(name => $name);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CampaignsApi->campaigns_by_name_get: $@\n";
}

Parameters

Name Type Description Notes
name string Name of Campaign to get

Return type

Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

campaigns_by_name_pause_put

campaigns_by_name_pause_put(name => $name)

Pause Campaign

Pauses the specific campaign, cancelling emails that are waiting to be sent. Required Access Level: ModifyCampaigns

Example

use Data::Dumper;
use ElasticEmail::CampaignsApi;
my $api_instance = ElasticEmail::CampaignsApi->new(

    # Configure API key authorization: apikey
    api_key => {'X-ElasticEmail-ApiKey' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'X-ElasticEmail-ApiKey' => 'Bearer'},
);

my $name = "name_example"; # string | Name of Campaign to pause

eval {
    $api_instance->campaigns_by_name_pause_put(name => $name);
};
if ($@) {
    warn "Exception when calling CampaignsApi->campaigns_by_name_pause_put: $@\n";
}

Parameters

Name Type Description Notes
name string Name of Campaign to pause

Return type

void (empty response body)

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

campaigns_by_name_put

Campaign campaigns_by_name_put(name => $name, campaign => $campaign)

Update Campaign

Updates a previously added campaign. Only Active and Paused campaigns can be updated. Required Access Level: ModifyCampaigns

Example

use Data::Dumper;
use ElasticEmail::CampaignsApi;
my $api_instance = ElasticEmail::CampaignsApi->new(

    # Configure API key authorization: apikey
    api_key => {'X-ElasticEmail-ApiKey' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'X-ElasticEmail-ApiKey' => 'Bearer'},
);

my $name = "name_example"; # string | Name of Campaign to update
my $campaign = ElasticEmail::Object::Campaign->new(); # Campaign | JSON representation of a campaign

eval {
    my $result = $api_instance->campaigns_by_name_put(name => $name, campaign => $campaign);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CampaignsApi->campaigns_by_name_put: $@\n";
}

Parameters

Name Type Description Notes
name string Name of Campaign to update
campaign Campaign JSON representation of a campaign

Return type

Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

campaigns_get

ARRAY[Campaign] campaigns_get(search => $search, offset => $offset, limit => $limit)

Load Campaigns

Returns a list all of your campaigns. Limited to 1000 results. Required Access Level: ViewCampaigns

Example

use Data::Dumper;
use ElasticEmail::CampaignsApi;
my $api_instance = ElasticEmail::CampaignsApi->new(

    # Configure API key authorization: apikey
    api_key => {'X-ElasticEmail-ApiKey' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'X-ElasticEmail-ApiKey' => 'Bearer'},
);

my $search = "search_example"; # string | Text fragment used for searching in Campaign name (using the 'contains' rule)
my $offset = 20; # int | How many items should be returned ahead.
my $limit = 100; # int | Maximum number of returned items.

eval {
    my $result = $api_instance->campaigns_get(search => $search, offset => $offset, limit => $limit);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CampaignsApi->campaigns_get: $@\n";
}

Parameters

Name Type Description Notes
search string Text fragment used for searching in Campaign name (using the 'contains' rule) [optional]
offset int How many items should be returned ahead. [optional]
limit int Maximum number of returned items. [optional]

Return type

ARRAY[Campaign]

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

campaigns_post

Campaign campaigns_post(campaign => $campaign)

Add Campaign

Add a campaign for processing. Required Access Level: ModifyCampaigns

Example

use Data::Dumper;
use ElasticEmail::CampaignsApi;
my $api_instance = ElasticEmail::CampaignsApi->new(

    # Configure API key authorization: apikey
    api_key => {'X-ElasticEmail-ApiKey' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'X-ElasticEmail-ApiKey' => 'Bearer'},
);

my $campaign = ElasticEmail::Object::Campaign->new(); # Campaign | JSON representation of a campaign

eval {
    my $result = $api_instance->campaigns_post(campaign => $campaign);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CampaignsApi->campaigns_post: $@\n";
}

Parameters

Name Type Description Notes
campaign Campaign JSON representation of a campaign

Return type

Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]