All URIs are relative to https://api.sendx.io/api/v1/rest
| Method | HTTP request | Description |
|---|---|---|
| create_campaign | POST /campaign | Create campaign |
| delete_campaign | DELETE /campaign/{identifier} | Delete campaign |
| get_all_campaigns | GET /campaign | Get all campaigns |
| get_campaign | GET /campaign/{identifier} | Get campaign by ID |
create_campaign(rest_e_campaign)
Create campaign
Creates a new email campaign.
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::CampaignApi.new
rest_e_campaign = SendX::RestECampaign.new({name: 'Spring Sale Campaign', subject: '🌸 Spring Sale - {{contact.firstName}}, Save 30%!', sender: 'sender_4vK3WFhMgvOwUNyaL4QxCD', html_code: '<html><body><h1>Spring Sale!</h1><p>Save 30% on all items</p></body></html>'}) # RestECampaign |
begin
# Create campaign
result = api_instance.create_campaign(rest_e_campaign)
p result
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->create_campaign: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_campaign_with_http_info(rest_e_campaign)
begin
# Create campaign
data, status_code, headers = api_instance.create_campaign_with_http_info(rest_e_campaign)
p status_code # => 2xx
p headers # => { ... }
p data # => <RestRCampaign>
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->create_campaign_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| rest_e_campaign | RestECampaign |
- Content-Type: application/json
- Accept: application/json
delete_campaign(identifier)
Delete campaign
Deletes a campaign.
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::CampaignApi.new
identifier = 'identifier_example' # String | Campaign identifier to delete
begin
# Delete campaign
result = api_instance.delete_campaign(identifier)
p result
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->delete_campaign: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> delete_campaign_with_http_info(identifier)
begin
# Delete campaign
data, status_code, headers = api_instance.delete_campaign_with_http_info(identifier)
p status_code # => 2xx
p headers # => { ... }
p data # => <DeleteResponse>
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->delete_campaign_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| identifier | String | Campaign identifier to delete |
- Content-Type: Not defined
- Accept: application/json
<Array> get_all_campaigns(opts)
Get all campaigns
Retrieves a paginated list of all campaigns.
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::CampaignApi.new
opts = {
offset: 56, # Integer | Number of campaigns to skip
limit: 56, # Integer | Maximum number of campaigns to return
campaign_type: 'all' # String | Filter by campaign type
}
begin
# Get all campaigns
result = api_instance.get_all_campaigns(opts)
p result
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->get_all_campaigns: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(<Array>, Integer, Hash)> get_all_campaigns_with_http_info(opts)
begin
# Get all campaigns
data, status_code, headers = api_instance.get_all_campaigns_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Array<RestRCampaign>>
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->get_all_campaigns_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| offset | Integer | Number of campaigns to skip | [optional][default to 0] |
| limit | Integer | Maximum number of campaigns to return | [optional][default to 10] |
| campaign_type | String | Filter by campaign type | [optional][default to 'all'] |
- Content-Type: Not defined
- Accept: application/json
get_campaign(identifier)
Get campaign by ID
Retrieves detailed information about a specific campaign.
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::CampaignApi.new
identifier = 'identifier_example' # String | Campaign identifier - `campaign_IMBoxK2iB5sUdgiNOjqAMA`
begin
# Get campaign by ID
result = api_instance.get_campaign(identifier)
p result
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->get_campaign: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_campaign_with_http_info(identifier)
begin
# Get campaign by ID
data, status_code, headers = api_instance.get_campaign_with_http_info(identifier)
p status_code # => 2xx
p headers # => { ... }
p data # => <RestRCampaign>
rescue SendX::ApiError => e
puts "Error when calling CampaignApi->get_campaign_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| identifier | String | Campaign identifier - `campaign_IMBoxK2iB5sUdgiNOjqAMA` |
- Content-Type: Not defined
- Accept: application/json