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(name)
Delete Template
Delete template with the specified name. Required Access Level: ModifyTemplates
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}"
endThis 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| Name | Type | Description | Notes |
|---|---|---|---|
| name | String | Name of template. |
nil (empty response body)
- Content-Type: Not defined
- Accept: Not defined
templates_by_name_get(name)
Load Template
Load detailed information of the specified template. Required Access Level: ViewTemplates
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}" endThis 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
Name Type Description Notes name String Name of template.
- Content-Type: Not defined
- Accept: application/json
templates_by_name_put(name, template_payload)
Update Template
Update existing template, overwriting existing data. Required Access Level: ModifyTemplates
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}" endThis 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
Name Type Description Notes name String Name of template. template_payload TemplatePayload
- Content-Type: application/json
- Accept: application/json
<Array> templates_get(scope_type, opts)
Load Templates
Returns a list of templates for the specified type. Required Access Level: ViewTemplates
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}" endThis 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
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]
- Content-Type: Not defined
- Accept: application/json
templates_post(template_payload)
Add Template
Add a new Template. Required Access Level: ModifyTemplates
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}" endThis 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
Name Type Description Notes template_payload TemplatePayload
- Content-Type: application/json
- Accept: application/json