Using MessageID to Retrieve Bounces
Today we’re releasing a change to the Postmark Bounce API that we think will make retrieving bounces from the system a whole lot easier!
Previously, in order to retrieve a specific bounce, a user would have to query using a filter similar to the following:
https://api.postmarkapp.com/bounces?count=10&offset=0&emailfilter=wildbit.com
A filter query like the above would return a list of bounces that were originally sent to the wildbit.com domain. Users would then have to sort the list for the specific bounce they were looking for. Once a user found the bounce, they’d have to re-query the API using the bounceID to retrieve the full content of the bounce, if needed:
https://api.postmarkapp.com/bounces/389296145
As of today, users can use the messageID field on the Bounces API to retrieve a specific bounce without first filtering by other criteria. The messageID is the string returned for each successfully sent email through the API. A typical response from the Email API looks like this:
{
“To”:“someone@example.com”,<br>
“SubmittedAt”:“2012-06-12T15:29:45.9688186-04:00”,<br>
“MessageID”:“bdd0ad3c-5128-4ad2-8b1d-223b1d3521dd”,<br>
“ErrorCode”:0,<br>
“Message”:“OK”<br>
}
Because users can save the messageIDs returned when the emails are first sent, they can use that information to query the Bounce API directly:
https://api.postmarkapp.com/bounces?messageID=bdd0ad3c-5128-4ad2-8b1d-223b1d3521dd
Note, when querying by messageID, the count and offset fields are not required.
To retrieve the full content of the bounce, users will still have to use the single bounce retrieval API endpoint with the bounceID.
We think this change will go a long way to help speed up bounce querying for a lot of end users!