public interface NotificationClientApi
| Modifier and Type | Method and Description |
|---|---|
TemplatePreview |
generateTemplatePreview(String templateId,
Map<String,Object> personalisation)
The generateTemplatePreview returns a template with the placeholders replaced with the given personalisation.
|
TemplateList |
getAllTemplates(String templateType)
Returns all the templates for your service.
|
Notification |
getNotificationById(String notificationId)
The getNotificationById method will return a
Notification for a given notification id. |
NotificationList |
getNotifications(String status,
String notification_type,
String reference,
String olderThanId)
The getNotifications method will create a GET HTTPS request to retrieve all the notifications.
|
byte[] |
getPdfForLetter(String notificationId)
The getPdfForLetter method will return a
byte[] containing the PDF contents of a given letter notification. |
ReceivedTextMessageList |
getReceivedTextMessages(String olderThanId)
The getReceivedTextMessages returns a list of
ReceivedTextMessage, the list is sorted by createdAt descending. |
Template |
getTemplateById(String templateId)
The getTemplateById returns a
Template given the template id. |
Template |
getTemplateVersion(String templateId,
int version)
The getTemplateVersion returns a
Template given the template id and version. |
SendEmailResponse |
sendEmail(String templateId,
String emailAddress,
Map<String,?> personalisation,
String reference)
The sendEmail method will create an HTTPS POST request.
|
SendEmailResponse |
sendEmail(String templateId,
String emailAddress,
Map<String,?> personalisation,
String reference,
String emailReplyToId)
The sendEmail method will create an HTTPS POST request.
|
SendLetterResponse |
sendLetter(String templateId,
Map<String,?> personalisation,
String reference)
The sendLetter method will create an HTTPS POST request.
|
LetterResponse |
sendPrecompiledLetter(String reference,
File precompiledPDF)
The sendPrecompiledLetter method will create an HTTPS POST request.
|
LetterResponse |
sendPrecompiledLetter(String reference,
File precompiledPDF,
String postage)
The sendPrecompiledLetter method will create an HTTPS POST request.
|
LetterResponse |
sendPrecompiledLetterWithInputStream(String reference,
InputStream stream)
The sendPrecompiledLetterWithInputStream method will create an HTTPS POST request.
|
LetterResponse |
sendPrecompiledLetterWithInputStream(String reference,
InputStream stream,
String postage)
The sendPrecompiledLetterWithInputStream method will create an HTTPS POST request.
|
SendSmsResponse |
sendSms(String templateId,
String phoneNumber,
Map<String,?> personalisation,
String reference)
The sendSms method will create an HTTPS POST request.
|
SendSmsResponse |
sendSms(String templateId,
String phoneNumber,
Map<String,?> personalisation,
String reference,
String smsSenderId)
The sendSms method will create an HTTPS POST request.
|
SendEmailResponse sendEmail(String templateId, String emailAddress, Map<String,?> personalisation, String reference) throws NotificationClientException
templateId - The template id is visible on the template page in the application.emailAddress - The email addresspersonalisation - Map representing the placeholders for the template if any. For example, key=name value=Bob
Can be an empty map or null when the template does not require placeholders.reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Can be an empty string or null, when you do not require a reference for the notifications.SendEmailResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-an-email-error-codesSendEmailResponse sendEmail(String templateId, String emailAddress, Map<String,?> personalisation, String reference, String emailReplyToId) throws NotificationClientException
templateId - The template id is visible on the template page in the application.emailAddress - The email addresspersonalisation - Map representing the placeholders for the template if any. For example, key=name value=Bob
Can be an empty map or null when the template does not require placeholders.reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Can be an empty string or null, when you do not require a reference for the notifications.emailReplyToId - An optional identifier for a reply to email address for the notification, rather than use the service default.
Service emailReplyToIds can be accessed via the service settings / manage email reply to addresses page.
Omit this argument to use the default service email reply to address.SendEmailResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-an-email-error-codesSendSmsResponse sendSms(String templateId, String phoneNumber, Map<String,?> personalisation, String reference) throws NotificationClientException
templateId - The template id is visible from the template page in the application.phoneNumber - The mobile phone numberpersonalisation - Map representing the placeholders for the template if any. For example, key=name value=Bob
Can be an empty map or null when the template does not require placeholders.reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Can be an empty string or null, when you do not require a reference for the notifications.SendSmsResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#error-codesSendSmsResponse sendSms(String templateId, String phoneNumber, Map<String,?> personalisation, String reference, String smsSenderId) throws NotificationClientException
templateId - The template id is visible from the template page in the application.phoneNumber - The mobile phone numberpersonalisation - Map representing the placeholders for the template if any. For example, key=name value=Bob
Can be an empty map or null when the template does not require placeholders.reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Can be an empty string or null, when you do not require a reference for the notifications.smsSenderId - An optional identifier for the text message sender of the notification, rather than use the service default.
Service smsSenderIds can be accessed via the service settings / manage text message senders page.
Omit this argument to use the default service text message sender.SendSmsResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#error-codesSendLetterResponse sendLetter(String templateId, Map<String,?> personalisation, String reference) throws NotificationClientException
templateId - Find templateId by clicking API info for the template you want to sendpersonalisation - Map representing the placeholders for the template if any. For example, key=name value=Bob.
Must include the keys "address_line_1", "address_line_2" and "postcode".reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Can be an empty string or null, when you do not require a reference for the notifications.SendLetterResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-a-letter-error-codesLetterResponse sendPrecompiledLetter(String reference, File precompiledPDF) throws NotificationClientException
reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Cannot be an empty string or null for precompiled PDF files.precompiledPDF - A file containing a PDF conforming to the Notify standards for printing.
The file must be a PDF and cannot be null.LetterResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-a-precompiled-letter-error-codesLetterResponse sendPrecompiledLetter(String reference, File precompiledPDF, String postage) throws NotificationClientException
reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Cannot be an empty string or null for precompiled PDF files.precompiledPDF - A file containing a PDF conforming to the Notify standards for printing.
The file must be a PDF and cannot be null.postage - You can choose first or second class postage for your precompiled letter.
Set the value to first for first class, or second for second class. If you do not pass in this argument, the postage will default to second class.LetterResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-a-precompiled-letter-error-codesLetterResponse sendPrecompiledLetterWithInputStream(String reference, InputStream stream) throws NotificationClientException
reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Cannot be an empty string or null for precompiled PDF files.stream - An InputStream conforming to the Notify standards for printing.
The InputStream cannot be null.LetterResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-a-precompiled-letter-error-codesLetterResponse sendPrecompiledLetterWithInputStream(String reference, InputStream stream, String postage) throws NotificationClientException
reference - A reference specified by the service for the notification. Get all notifications can be filtered by this reference.
This reference can be unique or used used to refer to a batch of notifications.
Cannot be an empty string or null for precompiled PDF files.stream - An InputStream conforming to the Notify standards for printing.
The InputStream cannot be null.postage - You can choose first or second class postage for your precompiled letter.
Set the value to first for first class, or second for second class. If you do not pass in this argument, the postage will default to second class.LetterResponseNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#send-a-precompiled-letter-error-codesNotification getNotificationById(String notificationId) throws NotificationClientException
Notification for a given notification id.
The id can be retrieved from the NotificationResponse of a sendEmail, sendLetter or sendSms request.notificationId - The id of the notification.NotificationNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#get-the-status-of-one-message-error-codesbyte[] getPdfForLetter(String notificationId) throws NotificationClientException
byte[] containing the PDF contents of a given letter notification.
The id can be retrieved from the NotificationResponse of a sendLetter.notificationId - The id of the notification.byte[] The raw pdf data.NotificationClientException - see https://docs.notifications.service.gov.uk/java.html#get-a-pdf-for-a-letter-notification-error-codesNotificationList getNotifications(String status, String notification_type, String reference, String olderThanId) throws NotificationClientException
status - If status is not empty or null notifications will only return notifications for the given status.
Possible statuses are created|sending|delivered|permanent-failure|temporary-failure|technical-failurenotification_type - If notification_type is not empty or null only notifications of the given status will be returned.
Possible notificationTypes are sms|emailreference - If reference is not empty or null only the notifications with that reference are returned.olderThanId - If olderThanId is not empty or null only the notifications older than that notification id are returned.NotificationListNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#get-the-status-of-multiple-messages-error-codesTemplate getTemplateById(String templateId) throws NotificationClientException
Template given the template id.templateId - The template id is visible on the template page in the application.TemplateNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#get-a-template-by-id-error-codesTemplate getTemplateVersion(String templateId, int version) throws NotificationClientException
Template given the template id and version.templateId - The template id is visible on the template page in the application.version - The version of the template to returnTemplateNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#get-a-template-by-id-and-version-error-codesTemplateList getAllTemplates(String templateType) throws NotificationClientException
templateType - If templateType is not empty or null templates will be filtered by type.
Possible template types are email|sms|letterTemplateListNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#get-a-template-by-id-error-codesTemplatePreview generateTemplatePreview(String templateId, Map<String,Object> personalisation) throws NotificationClientException
templateId - The template id is visible from the template page in the application.personalisation - Map representing the placeholders for the template if any. For example, key=name value=Bob
Can be an empty map or null when the template does not require placeholders.TemplateNotificationClientException - see https://docs.notifications.service.gov.uk/java.html#generate-a-preview-template-error-codesReceivedTextMessageList getReceivedTextMessages(String olderThanId) throws NotificationClientException
ReceivedTextMessage, the list is sorted by createdAt descending.olderThanId - If olderThanId is not empty or null only the received text messages older than that id are returned.ReceivedTextMessageListNotificationClientExceptionCopyright © 2019. All rights reserved.