All URIs are relative to https://api.sendx.io/api/v1/rest
| Method | HTTP request | Description |
|---|---|---|
| create_email_template | POST /template/email | Create email template |
| delete_email_template | DELETE /template/email/{identifier} | Delete template |
| get_all_email_templates | GET /template/email | Get all templates |
| get_email_template | GET /template/email/{identifier} | Get template by ID |
| update_email_template | PUT /template/email/{identifier} | Update template |
create_email_template(rest_e_template)
Create email template
Creates a new reusable email template.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-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-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::TemplateApi.new
rest_e_template = SendX::RestETemplate.new({name: 'Welcome Email Template', subject: 'Welcome to {{company_name}}!'}) # RestETemplate |
begin
# Create email template
result = api_instance.create_email_template(rest_e_template)
p result
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->create_email_template: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_email_template_with_http_info(rest_e_template)
begin
# Create email template
data, status_code, headers = api_instance.create_email_template_with_http_info(rest_e_template)
p status_code # => 2xx
p headers # => { ... }
p data # => <RestRTemplate>
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->create_email_template_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| rest_e_template | RestETemplate |
- Content-Type: application/json
- Accept: application/json
delete_email_template(identifier)
Delete template
Deletes an email template.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-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-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::TemplateApi.new
identifier = 'template_f3lJvTEhSjKGVb5Lwc5SWS' # String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS`
begin
# Delete template
result = api_instance.delete_email_template(identifier)
p result
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->delete_email_template: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> delete_email_template_with_http_info(identifier)
begin
# Delete template
data, status_code, headers = api_instance.delete_email_template_with_http_info(identifier)
p status_code # => 2xx
p headers # => { ... }
p data # => <DeleteResponse>
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->delete_email_template_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| identifier | String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS` |
- Content-Type: Not defined
- Accept: application/json
<Array> get_all_email_templates(opts)
Get all templates
Retrieves all email templates.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-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-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::TemplateApi.new
opts = {
offset: 56, # Integer | Number of records to skip for pagination. **Examples:** - `0` - First page (default) - `25` - Second page (with limit=25) - `50` - Third page (with limit=25)
limit: 56, # Integer | Maximum number of templates to return per page. **Guidelines:** - Default: 10 templates - Maximum: 100 templates - Recommended: 25-100 for optimal performance
search: 'search_example' # String | Search templates by name (case-insensitive partial matching). **Examples:** - `newsletter` - Finds \"Weekly Newsletter\", \"Monthly Newsletter\" - `welcome` - Finds \"Welcome Email\", \"New User Welcome\" - `product` - Finds \"Product Launch\", \"Product Update\"
}
begin
# Get all templates
result = api_instance.get_all_email_templates(opts)
p result
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->get_all_email_templates: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(<Array>, Integer, Hash)> get_all_email_templates_with_http_info(opts)
begin
# Get all templates
data, status_code, headers = api_instance.get_all_email_templates_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Array<RestRTemplate>>
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->get_all_email_templates_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| offset | Integer | Number of records to skip for pagination. Examples: - `0` - First page (default) - `25` - Second page (with limit=25) - `50` - Third page (with limit=25) | [optional][default to 0] |
| limit | Integer | Maximum number of templates to return per page. Guidelines: - Default: 10 templates - Maximum: 100 templates - Recommended: 25-100 for optimal performance | [optional][default to 10] |
| search | String | Search templates by name (case-insensitive partial matching). Examples: - `newsletter` - Finds "Weekly Newsletter", "Monthly Newsletter" - `welcome` - Finds "Welcome Email", "New User Welcome" - `product` - Finds "Product Launch", "Product Update" | [optional] |
- Content-Type: Not defined
- Accept: application/json
get_email_template(identifier)
Get template by ID
Retrieves a specific email template.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-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-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::TemplateApi.new
identifier = 'template_f3lJvTEhSjKGVb5Lwc5SWS' # String | The unique template identifier. - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID
begin
# Get template by ID
result = api_instance.get_email_template(identifier)
p result
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->get_email_template: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_email_template_with_http_info(identifier)
begin
# Get template by ID
data, status_code, headers = api_instance.get_email_template_with_http_info(identifier)
p status_code # => 2xx
p headers # => { ... }
p data # => <RestRTemplate>
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->get_email_template_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| identifier | String | The unique template identifier. - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID |
- Content-Type: Not defined
- Accept: application/json
update_email_template(rest_e_template, identifier)
Update template
Updates an existing email template.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-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-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::TemplateApi.new
rest_e_template = SendX::RestETemplate.new({name: 'Welcome Email Template', subject: 'Welcome to {{company_name}}!'}) # RestETemplate |
identifier = 'template_f3lJvTEhSjKGVb5Lwc5SWS' # String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS`
begin
# Update template
result = api_instance.update_email_template(rest_e_template, identifier)
p result
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->update_email_template: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> update_email_template_with_http_info(rest_e_template, identifier)
begin
# Update template
data, status_code, headers = api_instance.update_email_template_with_http_info(rest_e_template, identifier)
p status_code # => 2xx
p headers # => { ... }
p data # => <RestRTemplate>
rescue SendX::ApiError => e
puts "Error when calling TemplateApi->update_email_template_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| rest_e_template | RestETemplate | ||
| identifier | String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS` |
- Content-Type: application/json
- Accept: application/json