Skip to content

Latest commit

 

History

History
376 lines (268 loc) · 10.1 KB

File metadata and controls

376 lines (268 loc) · 10.1 KB

ElasticEmail::TemplatesApi

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

Method HTTP request Description
templates_by_name_delete DELETE /templates/{name} Delete Template
templates_by_name_get GET /templates/{name} Load Template
templates_by_name_put PUT /templates/{name} Update Template
templates_get GET /templates Load Templates
templates_post POST /templates Add Template

templates_by_name_delete

templates_by_name_delete(name)

Delete Template

Delete template with the specified name. Required Access Level: ModifyTemplates

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::TemplatesApi.new
name = 'Template01' # String | Name of template.

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

Using the templates_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)> templates_by_name_delete_with_http_info(name)

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

Parameters

Name Type Description Notes
name String Name of template.

Return type

nil (empty response body)

Authorization

apikey

HTTP request headers

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

templates_by_name_get

templates_by_name_get(name)

Load Template

Load detailed information of the specified template. Required Access Level: ViewTemplates

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::TemplatesApi.new
name = 'Template01' # String | Name of template.

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

Using the templates_by_name_get_with_http_info variant

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

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

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

Parameters

Name Type Description Notes
name String Name of template.

Return type

Template

Authorization

apikey

HTTP request headers

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

templates_by_name_put

templates_by_name_put(name, template_payload)

Update Template

Update existing template, overwriting existing data. Required Access Level: ModifyTemplates

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::TemplatesApi.new
name = 'Template01' # String | Name of template.
template_payload = ElasticEmail::TemplatePayload.new({name: 'name_example'}) # TemplatePayload | 

begin
  # Update Template
  result = api_instance.templates_by_name_put(name, template_payload)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling TemplatesApi->templates_by_name_put: #{e}"
end

Using the templates_by_name_put_with_http_info variant

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

<Array(, Integer, Hash)> templates_by_name_put_with_http_info(name, template_payload)

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

Parameters

Name Type Description Notes
name String Name of template.
template_payload TemplatePayload

Return type

Template

Authorization

apikey

HTTP request headers

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

templates_get

<Array> templates_get(scope_type, opts)

Load Templates

Returns a list of templates for the specified type. Required Access Level: ViewTemplates

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::TemplatesApi.new
scope_type = [ElasticEmail::TemplateScope::PERSONAL] # Array<TemplateScope> | Return templates with specified scope only
opts = {
  template_types: [ElasticEmail::TemplateType::RAW_HTML], # Array<TemplateType> | Return templates with specified type only
  limit: 100, # Integer | Maximum number of returned items.
  offset: 20 # Integer | How many items should be returned ahead.
}

begin
  # Load Templates
  result = api_instance.templates_get(scope_type, opts)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling TemplatesApi->templates_get: #{e}"
end

Using the templates_get_with_http_info variant

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

<Array(<Array>, Integer, Hash)> templates_get_with_http_info(scope_type, opts)

begin
  # Load Templates
  data, status_code, headers = api_instance.templates_get_with_http_info(scope_type, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Array<Template>>
rescue ElasticEmail::ApiError => e
  puts "Error when calling TemplatesApi->templates_get_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
scope_type Array<TemplateScope> Return templates with specified scope only
template_types Array<TemplateType> Return templates with specified type only [optional]
limit Integer Maximum number of returned items. [optional]
offset Integer How many items should be returned ahead. [optional]

Return type

Array<Template>

Authorization

apikey

HTTP request headers

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

templates_post

templates_post(template_payload)

Add Template

Add a new Template. Required Access Level: ModifyTemplates

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::TemplatesApi.new
template_payload = ElasticEmail::TemplatePayload.new({name: 'name_example'}) # TemplatePayload | 

begin
  # Add Template
  result = api_instance.templates_post(template_payload)
  p result
rescue ElasticEmail::ApiError => e
  puts "Error when calling TemplatesApi->templates_post: #{e}"
end

Using the templates_post_with_http_info variant

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

<Array(, Integer, Hash)> templates_post_with_http_info(template_payload)

begin
  # Add Template
  data, status_code, headers = api_instance.templates_post_with_http_info(template_payload)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Template>
rescue ElasticEmail::ApiError => e
  puts "Error when calling TemplatesApi->templates_post_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_payload TemplatePayload

Return type

Template

Authorization

apikey

HTTP request headers

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