Skip to content

Latest commit

 

History

History
518 lines (368 loc) · 14.1 KB

File metadata and controls

518 lines (368 loc) · 14.1 KB

ElasticEmail::CampaignsApi

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

Method HTTP request Description
campaigns_automation_by_name_trigger_post POST /campaigns/automation/{name}/trigger Trigger Automation for Contact
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_automation_by_name_trigger_post

campaigns_automation_by_name_trigger_post(name, contact_email)

Trigger Automation for Contact

Manually trigger an Automation for a contact. Required Access Level: ModifyAutomations

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
name = 'name_example' # String | 
contact_email = 'contact_email_example' # String | 

begin
  # Trigger Automation for Contact
  api_instance.campaigns_automation_by_name_trigger_post(name, contact_email)
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_automation_by_name_trigger_post: #{e}"
end

Using the campaigns_automation_by_name_trigger_post_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> campaigns_automation_by_name_trigger_post_with_http_info(name, contact_email)

begin
  # Trigger Automation for Contact
  data, status_code, headers = api_instance.campaigns_automation_by_name_trigger_post_with_http_info(name, contact_email)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_automation_by_name_trigger_post_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
name String
contact_email String

Return type

nil (empty response body)

Authorization

apikey

HTTP request headers

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

campaigns_by_name_delete

campaigns_by_name_delete(name)

Delete Campaign

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

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
name = 'name_example' # String | Name of Campaign to delete

begin
  # Delete Campaign
  api_instance.campaigns_by_name_delete(name)
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_delete: #{e}"
end

Using the campaigns_by_name_delete_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> campaigns_by_name_delete_with_http_info(name)

begin
  # Delete Campaign
  data, status_code, headers = api_instance.campaigns_by_name_delete_with_http_info(name)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_delete_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
name String Name of Campaign to delete

Return type

nil (empty response body)

Authorization

apikey

HTTP request headers

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

campaigns_by_name_get

campaigns_by_name_get(name)

Load Campaign

Returns the specified campaign details. Required Access Level: ViewCampaigns

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
name = 'name_example' # String | Name of Campaign to get

begin
  # Load Campaign
  result = api_instance.campaigns_by_name_get(name)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_get: #{e}"
end

Using the campaigns_by_name_get_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> campaigns_by_name_get_with_http_info(name)

begin
  # Load Campaign
  data, status_code, headers = api_instance.campaigns_by_name_get_with_http_info(name)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Campaign>
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_get_with_http_info: #{e}"
end

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

campaigns_by_name_pause_put

campaigns_by_name_pause_put(name)

Pause Campaign

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

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
name = 'name_example' # String | Name of Campaign to pause

begin
  # Pause Campaign
  api_instance.campaigns_by_name_pause_put(name)
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_pause_put: #{e}"
end

Using the campaigns_by_name_pause_put_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> campaigns_by_name_pause_put_with_http_info(name)

begin
  # Pause Campaign
  data, status_code, headers = api_instance.campaigns_by_name_pause_put_with_http_info(name)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_pause_put_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
name String Name of Campaign to pause

Return type

nil (empty response body)

Authorization

apikey

HTTP request headers

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

campaigns_by_name_put

campaigns_by_name_put(name, campaign)

Update Campaign

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

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
name = 'name_example' # String | Name of Campaign to update
campaign = ElasticEmail::Campaign.new({name: 'name_example', recipients: ElasticEmail::CampaignRecipient.new}) # Campaign | JSON representation of a campaign

begin
  # Update Campaign
  result = api_instance.campaigns_by_name_put(name, campaign)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_put: #{e}"
end

Using the campaigns_by_name_put_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> campaigns_by_name_put_with_http_info(name, campaign)

begin
  # Update Campaign
  data, status_code, headers = api_instance.campaigns_by_name_put_with_http_info(name, campaign)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Campaign>
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_by_name_put_with_http_info: #{e}"
end

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

campaigns_get

<Array> campaigns_get(opts)

Load Campaigns

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

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
opts = {
  search: 'search_example', # String | Text fragment used for searching in Campaign name (using the 'contains' rule)
  offset: 20, # Integer | How many items should be returned ahead.
  limit: 100 # Integer | Maximum number of returned items.
}

begin
  # Load Campaigns
  result = api_instance.campaigns_get(opts)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_get: #{e}"
end

Using the campaigns_get_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(<Array>, Integer, Hash)> campaigns_get_with_http_info(opts)

begin
  # Load Campaigns
  data, status_code, headers = api_instance.campaigns_get_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Array<Campaign>>
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_get_with_http_info: #{e}"
end

Parameters

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

Return type

Array<Campaign>

Authorization

apikey

HTTP request headers

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

campaigns_post

campaigns_post(campaign)

Add Campaign

Add a campaign for processing. Required Access Level: ModifyCampaigns

Examples

require 'time'
require 'ElasticEmail'
# setup authorization
ElasticEmail.configure do |config|
  # Configure API key authorization: apikey
  config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
end

api_instance = ElasticEmail::CampaignsApi.new
campaign = ElasticEmail::Campaign.new({name: 'name_example', recipients: ElasticEmail::CampaignRecipient.new}) # Campaign | JSON representation of a campaign

begin
  # Add Campaign
  result = api_instance.campaigns_post(campaign)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_post: #{e}"
end

Using the campaigns_post_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> campaigns_post_with_http_info(campaign)

begin
  # Add Campaign
  data, status_code, headers = api_instance.campaigns_post_with_http_info(campaign)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Campaign>
rescue ElasticEmail::ApiError => e
  puts "Error when calling CampaignsApi->campaigns_post_with_http_info: #{e}"
end

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