-
Notifications
You must be signed in to change notification settings - Fork 21
Suppressions
Igor Balos edited this page Feb 6, 2020
·
3 revisions
In order to manage suppressions, you can use suppression endpoints from Postmark API client. For details about suppressions check out suppressions API.
For these API requests you will need to use a server API token. Once you obtain it, you will need to use server API client.
ApiClient client = Postmark.getApiClient(<server token>);
List all the suppressions:
String messageStream = "outbound";
Suppressions suppressions = client.getSuppressions(messageStream);
for (Suppression s: suppressions.getSuppressions()) {
System.out.println(s.getEmailAddress());
}
Create suppressions:
String messageStream = "outbound";
String[] addresses = { "[email protected]", "[email protected]"};
SuppressionStatuses createStatuses = client.createSuppressions(messageStream, new SuppressionEntries(addresses));
Delete suppressions:
String messageStream = "outbound";
String[] addresses = { "[email protected]", "[email protected]"};
SuppressionStatuses deleteStatuses = client.deleteSuppressions(messageStream, new SuppressionEntries(addresses));
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.