Skip to content

Templates pushes

Igor Balos edited this page Dec 18, 2018 · 2 revisions

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.

AccountApiClient client = Postmark.getAccountApiClient(<account token>);

Push templates to another server

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

// push request details
Integer sourceServerId = 1;
Integer destinationServerId = 2;
TemplatesPushRequest pushRequest = new TemplatesPushRequest(sourceServerId,destinationServerId, true);

// push templates
TemplatesPush templatesPush = accountClient.pushTemplates(pushRequest);

System.out.println(templatesPush.getTotalCount());
System.out.println(templatesPush.getTemplates().get(0).getAction());
System.out.println(templatesPush.getTemplates().get(0).getAlias());
System.out.println(templatesPush.getTemplates().get(0).getName());