Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 31
Stats
You can retrieve many different statistics by API. Here are couple of examples on how statistics retrieval can be used.
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.
ApiClientclient = Postmark.getApiClient(<servertoken>);Listing outbound statistics.
Calendarcal = Calendar.getInstance();
cal.add(Calendar.DATE, - 365);
DatelastYear = cal.getTime();
// stats outboundOutboundStatsstats = client.getOutboundStats(Parameters.init().build("fromDate", lastYear));
System.out.println(stats.getBounced());List sent email statistics.
// stats sentOutboundSendStatsstatsSent = client.getOutboundSendStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsSent.getDays());List bounced email statistics.
// stats bounceOutboundBounceStatsstatsBounce = client.getOutboundBounceStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsBounce.getDays());List spam email statistics.
// stats spamOutboundSpamStatsstatsSpam = client.getOutboundSpamStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsSpam.getDays());List clicked email statistics.
// stats trackedOutboundTrackedStatsstatsTracked = client.getOutboundTrackedStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsTracked.getDays());List opened email statistics.
// stats opensOutboundOpenStatsstatsOpens = client.getOutboundOpenStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsOpens.getDays());List opened platforms email statistics.
// stats open platformsOutboundOpenPlatformStatsstatsOpenPlatoforms = client.getOutboundOpenPlatformStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsOpenPlatoforms.getDays());List email open clients statistics.
// stats open clientsHashMapstatsOpenClient = client.getOutboundOpenClientStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsOpenClient.get("Days"));List email open read time statistics.
// stats open read timesHashMapstatsOpenReadTimes = client.getOutboundOpenReadTimes(Parameters.init().build("fromDate", lastYear));
System.out.println(statsOpenReadTimes.get("Days"));List email click detailed statistics.
// stats clicksOutboundClickStatsstatsClicks = client.getOutboundClickStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsClicks.getDays().get(0).getClicks());List email click browser usage statistics.
// stats clicksHashMapstatsClicksBrowserUsage = client.getOutboundClickBrowsersStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsClicksBrowserUsage.get("Days"));List email click platform statistics.
// stats platformOutboundClickPlatformStatsstatsClicksPlatform = client.getOutboundClickPlatformStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsClicksPlatform.getDays());List email click location statistics.
// stats click locationSystem.out.println("STATS CLICKS LOCATION");
OutboundClickLocationStatsstatsClicksLocation = client.getOutboundClickLocationStats(Parameters.init().build("fromDate", lastYear));
System.out.println(statsClicksLocation.getDays());For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.