-
Notifications
You must be signed in to change notification settings - Fork 21
Message Streams
Igor Balos edited this page Dec 8, 2020
·
5 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>);
List message streams
//Message Streams list
MessageStreams streams = client.getMessageStreams(Parameters.init().build("MessageStreamType","broadcasts"));
System.out.println(streams.getMessageStreams()[0].getName());
Retrieve single message stream
// Get stream with filter
String streamId="bulk";
MessageStream stream = client.getMessageStream(streamId);
System.out.println(stream.getName());
Update message stream
MessageStream stream = new MessageStream();
stream.setDescription("Igor bulker is now really");
stream.setSubscriptionManagementConfiguration(new SubscriptionManagementConfiguration("Custom"));
MessageStream response = client.setMessageStream("bulk", stream);
Create message stream
MessageStream streamToCreate = new MessageStream("bulker11","bulk name", "description", "Broadcasts", new SubscriptionManagementConfiguration());
MessageStream streamResponse = client.createMessageStream(streamToCreate);
System.out.println(streamResponse.getName());
Archive message stream
MessageStreamArchiveResponse response = client.archiveMessageStream("bulk");
Unarchive message stream
MessageStreamUnarchiveResponse response = client.unarchiveMessageStream("bulk");
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.