-
Notifications
You must be signed in to change notification settings - Fork 21
Messages
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 sent messages.
// outbound messages
OutboundMessages messages = client.getMessages(Parameters.init().build("count", 4).build("offset", 0));
String messageId = messages.getMessages().get(0).getMessageId();
Retrieve single message details.
// outbound message details
OutboundMessageDetails message = client.getMessageDetails(messageId);
System.out.println(message.getReceivedAt());
Retrieve single message details with parameters when message is too big.
By default, within the Postmark UI and via Messages API we will truncate the size of the returned message raw source if message is too big.
If the base64 has been truncated, then you can instead use our API to get the full raw source containing full attachment data with the following query parameter:
// outbound message details
Parameters parameters = new Parameters().build("includeMessageContent", "Full");
OutboundMessageDetails message = client.getMessageDetails(messageId,parameters);
System.out.println(message.getReceivedAt());
Retriveve single message dump content.
// outbound message dump
OutboundMessageDump messageDump = client.getMessageDump(messageId);
System.out.println(message.getBody());
List processed messages.
// inbound messages
InboundMessages inboundMessages = client.getInboundMessages(Parameters.init().build("count", 6).build("offset", 0));
messageId = inboundMessages.getInboundMessages().get(0).getMessageId();
System.out.println(inboundMessages.getInboundMessages().get(0).getDate());
List single processed message details.
// inbound message details
InboundMessageDetails inboundMessageDetails = client.getInboundMessageDetails(messageId);
System.out.println(inboundMessageDetails.getHeaders());
Retry failed inbound message.
// retry inbound message
String response = client.retryFailedInboundMessage(messageId);
Bypass inbound message.
// bypass inbound message
String response = client.bypassInboundMessage(messageId);
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.