Skip to content

Bounces

Igor Balos edited this page Jun 18, 2018 · 13 revisions

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>);

Get delivery stats

// get delivery stats
DeliveryStats deliveryStats = client.getDeliveryStats();

// get name of the first template in the list
deliveryStats.getBounces().get(0).getName();

Get list of available bounces

// get list of bounces
Bounces bounces = client.getBounces(Parameters.init().build("count", 1).build("offset", 0));

// get name of the first bounce in the list
bounces.getBounces().get(0).getName()

Get bounce by ID

Bounces bounces = client.getBounces(Parameters.init().build("count", 1).build("offset", 0));

// get bounce by ID
Integer bounceId = bounces.get(0).getId();
Bounce bounce = client.getBounce(bounceId);

Get bounce dump

// get bounce dump by bounce ID
BounceDump bounceDump = client.getBounceDump(bounceId);

Activate bounced message

String bounceActivate = client.activateBounce(bounceId);
System.out.println(bounceActivate);

Bounce tags

ArrayList<String> bounceTags = client.getBounceTags();
String tag = bounceTags.get(0);