Skip to content

Templates push

Igor Balos edited this page Jan 22, 2019 · 1 revision

For these API requests you will need to use a account API token. Once you obtain it, you will need to use account API client.

account_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
client = Postmark::AccountApiClient.new(account_token, secure: true)

You can easily push templates from one server to another one.

Preview push templates

In order to preview which templates would be pushed from one server to another one, you will need to do the following:

# preview template push
client.push_templates({source_server_id: 1, destination_server_id:2, perform_changes: false} )

# => [{:action=>"Create", :template_id=>nil, :alias=>"alias1", :name=>"Comment notification"},{:action=>"Create", :template_id=>nil, :alias=>"alias2", :name=>"Password reset"}]

Push templates

In order to push templates from one server to another one, you will need to do the following:

# templates push
client.push_templates({source_server_id: 1, destination_server_id:2, perform_changes: true} )

# => [{:action=>"Create", :template_id=>3, :alias=>"alias1", :name=>"Comment notification"},{:action=>"Create", :template_id=>4, :alias=>"alias2", :name=>"Password reset"}]