Skip to content

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 bounces:

// retrieve a list of bounces
Bounces bounces = client.getBounces(Parameters.init().build("count", 1).build("offset", 0));
bounces.getBounces().get(0).getBouncedAt();
// retrieve first bounce from bounce list and it's id
Bounces bounces client.getBounces(Parameters.init().build("count", 1).build("offset", 0));
Integer bounceId = bounces.getBounces().get(0).getId()

// retrieve a single bounce by bounce ID
Bounce bounce = client.getBounce(bounceId);
System.out.println(bounce.getDescription());
// retrieve a single bounce dump
BounceDump bounceDump = client.getBounceDump(bounceId);
// activate a single bounce message
Bounces bounces = client.getBounces(Parameters.init().build("count", 1).build("offset", 0).build("inactive",true));
client.activateBounce(bounces.getBounces().get(0).getId());