public class MaileonContactsService extends AbstractMaileonService
MaileonContactsService
client sends operational requests to the ContactsResource
.AbstractMaileonService.QueryParameters
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SERVICE |
MAILEON_XML_TYPE
Constructor and Description |
---|
MaileonContactsService(MaileonConfiguration config)
Constructs a
MaileonContactsService . |
Modifier and Type | Method and Description |
---|---|
void |
createBackupInstruction(FieldBackupInstruction fbi)
Creates a backup storage for the values of indicated contact fields.
|
void |
createContact(Contact contact,
SynchronizationMode syncMode)
Creates a single contact with a given synchronization mode.
|
void |
createContact(Contact contact,
SynchronizationMode syncMode,
java.lang.String src,
java.lang.String subscriptionPage,
boolean doi,
boolean doiPlus,
java.lang.String doiMailingKey)
Creates a single contact.
|
void |
createContact(Contact contact,
SynchronizationMode syncMode,
java.lang.String src,
java.lang.String subscriptionPage,
boolean doi,
boolean doiPlus,
java.lang.String doiMailingKey,
boolean useExternalIdasPrimaryID)
Creates a single contact and allows the usage of an externalID.
|
void |
createContactJSON(Contact contact,
SynchronizationMode syncMode,
java.lang.String src,
java.lang.String subscriptionPage,
boolean doi,
boolean doiPlus,
java.lang.String doiMailingKey)
Creates a single contact in JSON format.
|
void |
createContactJSON(Contact contact,
SynchronizationMode syncMode,
java.lang.String src,
java.lang.String subscriptionPage,
boolean doi,
boolean doiPlus,
java.lang.String doiMailingKey,
boolean useExternalIdasPrimaryID)
Creates a single contact in JSON format and allows the usage of an externalID.
|
void |
createCustomField(java.lang.String name,
java.lang.String type)
Creates a custom contact field with the provided name and data type.
|
void |
deleteBackupInstruction(long id)
Deletes the contact field backup instruction with the provided id in the request path.
|
void |
deleteBackupInstructions()
Deletes all the contact field backup instructions in the account.
|
void |
deleteContactsByEmail(java.lang.String email)
Removes a contact completely given an email address.
|
void |
deleteContactsByExternalId(java.lang.String externalId)
Removes a contact completely given an external contact id.
|
void |
deleteContactsByMaileonId(long contactId)
Removes a contact completely given a maileon contact id.
|
void |
deleteCustomField(java.lang.String field)
Deletes the custom contact field with the provided name.
|
void |
deleteCustomFieldValues(java.lang.String field)
Removes the values of a specified custom contact property for all contacts.
|
void |
deleteStandardFieldValues(StandardContactField field)
Removes the values of a specified standard contact property for all contacts.
|
Page<BlockedContact> |
getBlockedContacts(java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields,
int pageIndex,
int pageSize)
Returns a page of blocked contacts.
|
Contact |
getContact(long id,
java.lang.String checksum,
java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields)
Returns a single contact using maileon contact id.
|
Contact |
getContact(java.lang.String email,
java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields)
Returns a single contact with a given email address.
|
Page<Contact> |
getContacts(java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields,
int pageIndex,
int pageSize)
Returns a page of contacts in the accounts.
|
java.util.List<Contact> |
getContactsByEmail(java.lang.String email,
java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields)
Returns the contacts having the provided email address.
|
java.util.List<Contact> |
getContactsByExternalId(java.lang.String externalId,
java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields)
Returns a list of contacts using an external id.
|
Page<Contact> |
getContactsByFilterId(long contactFilterId,
java.util.List<StandardContactField> standardFields,
java.util.List<java.lang.String> customFields,
int pageIndex,
int pageSize)
Returns a page of contacts in the accounts that match a particular filter.
|
int |
getCountContacts()
Gets the total count of contacts in the account.
|
java.util.List<CustomContactFieldDefinition> |
getCustomFields()
Gets all cutom fields defined in the account.
|
java.util.List<FieldBackupInstruction> |
getFieldBackupInstructions()
Returns the contact field backup instruction that are available in the account.
|
void |
renameCustomField(java.lang.String oldName,
java.lang.String newName)
Renames a custom contact field.
|
SynchronizationReport |
synchronizeContacts(java.util.List<Contact> contacts,
Permission permission,
SynchronizationMode syncMode,
boolean useExternalId,
boolean ignoreInvalidContacts,
boolean reimportUnsubscribedContacts,
boolean overridePermission,
boolean updateOnly)
This method synchronizes (updates) a list of contatcs in the account.
|
SynchronizationReport |
synchronizeContacts(java.util.List<Contact> contacts,
Permission permission,
SynchronizationMode syncMode,
boolean useExternalId,
boolean ignoreInvalidContacts,
boolean reimportUnsubscribedContacts,
boolean overridePermission,
boolean updateOnly,
boolean preferMaileonId)
This method synchronizes (updates) a list of contatcs in the account.
|
void |
unsubscribeContactByEmailFromMultipleAccounts(java.lang.String email,
java.util.List<java.lang.Long> nlAccountIds)
Unsubscribes a contact with the given email in multiple newsletter accounts.
|
void |
unsubscribeContactByExternalId(java.lang.String externalId)
Unsubscribes a contact using an external contact id.
|
void |
unsubscribeContactById(int contactId)
Unsubscribes a contact using the maileon contact id.
|
void |
unsubscribeContactsByEmail(java.lang.String email)
Unsubscribes the contact(s) with the given email address in the account.
|
void |
updateContact(Contact contact,
java.lang.String checksum,
boolean triggerDoi,
java.lang.String src,
java.lang.String pageKey,
java.lang.String doiMailingKey,
boolean ignoreChecksum)
Updates a contact using particular settings.
|
delete, delete, delete, encodePath, get, get, get, isCompressionEnabled, isDebug, isRequestCompressionEnabled, post, post, post, put, put, put, setCompressionEnabled, setDebug, setRequestCompressionEnabled
public static final java.lang.String SERVICE
public MaileonContactsService(MaileonConfiguration config)
MaileonContactsService
.config
- Maileon API-Configuration.public int getCountContacts() throws MaileonException
MaileonException
public void createContact(Contact contact, SynchronizationMode syncMode) throws MaileonException
contact
- the Contact
object to create.syncMode
- the SynchronizationMode
determines the case whether the contact should be update or ignored if it already exists.MaileonException
- the maileon exceptionpublic SynchronizationReport synchronizeContacts(java.util.List<Contact> contacts, Permission permission, SynchronizationMode syncMode, boolean useExternalId, boolean ignoreInvalidContacts, boolean reimportUnsubscribedContacts, boolean overridePermission, boolean updateOnly) throws MaileonException
contacts
- list of Contact
to synchronize.permission
- the assigned permission (none, single opt-in, double opt-in, ..., etc).syncMode
- the SynchronizationMode
determines the case whether the permission should be updated or ignored if they already exist.useExternalId
- if true
the externalId will be used as a contact identifier, otherwise the email.ignoreInvalidContacts
- if true
the invalid contacts will be ignored.reimportUnsubscribedContacts
- if true
the unsubscribed contacts will be reimported, otherwise they will be ignored.overridePermission
- if true
the permission of existing and non existing contacts will be overwridden. In case of false
, the permission will
be used for new contacts only and existing contacts will not be influenced.updateOnly
- if true
only existing contacts are updated and no new contacts are created.SynchronizationReport
detailed report with statistics and validation errors.MaileonException
public SynchronizationReport synchronizeContacts(java.util.List<Contact> contacts, Permission permission, SynchronizationMode syncMode, boolean useExternalId, boolean ignoreInvalidContacts, boolean reimportUnsubscribedContacts, boolean overridePermission, boolean updateOnly, boolean preferMaileonId) throws MaileonException
contacts
- list of Contact
to synchronize.permission
- the assigned permission (none, single opt-in, double opt-in, ..., etc).syncMode
- the SynchronizationMode
determines the case whether the permission should be updated or ignored if they already exist.useExternalId
- if true
the externalId will be used as a contact identifier, otherwise the email.ignoreInvalidContacts
- if true
the invalid contacts will be ignored.reimportUnsubscribedContacts
- if true
the unsubscribed contacts will be reimported, otherwise they will be ignored.overridePermission
- if true
the permission of existing and non existing contacts will be overwridden. In case of false
, the permission will
be used for new contacts only and existing contacts will not be influenced.updateOnly
- if true
only existing contacts are updated and no new contacts are created.preferMaileonId
- if true
Maileon tries identifying contacts by Maileon-ID, if available. Fallback is always the email address, combination with
useExternalId is forbidden.SynchronizationReport
detailed report with statistics and validation errors.MaileonException
public void createContact(Contact contact, SynchronizationMode syncMode, java.lang.String src, java.lang.String subscriptionPage, boolean doi, boolean doiPlus, java.lang.String doiMailingKey) throws MaileonException
contact
- the Contact
to create.syncMode
- the SynchronizationMode
determines whether the permission should be updated or ignored if they already exist.src
- the source of the contact if provided.subscriptionPage
- in case where this method was called by a subscription page. If provided, then it offers the possibility to track the contacts for reporting usages.doi
- the doi, default false
. It determines where a double opt-in process should be started for the created contact.doiPlus
- the doi plus, default false
. The same as above, however doi plus will ignored if the parameter doi is set to false
.doiMailingKey
- whether the doi mailing key should be used or not. It is also dependent on the doi parameter (activated or not).MaileonException
- the maileon exceptionpublic void createContact(Contact contact, SynchronizationMode syncMode, java.lang.String src, java.lang.String subscriptionPage, boolean doi, boolean doiPlus, java.lang.String doiMailingKey, boolean useExternalIdasPrimaryID) throws MaileonException
contact
- the Contact
to create.syncMode
- the SynchronizationMode
determines whether the permission should be updated or ignored if they already exist.src
- the source of the contact if provided.subscriptionPage
- in case where this method was called by a subscription page. If provided, then it offers the possibility to track the contacts for reporting usages.doi
- the doi, default false
. It determines where a double opt-in process should be started for the created contact.doiPlus
- the doi plus, default false
. The same as above, however doi plus will ignored if the parameter doi is set to false
.doiMailingKey
- whether the doi mailing key should be used or not. It is also dependent on the doi parameter (activated or not).useExternalIdasPrimaryID
- if true
the externalId will be used as a contact identifier, otherwise the email.MaileonException
- the maileon exceptionpublic void createContactJSON(Contact contact, SynchronizationMode syncMode, java.lang.String src, java.lang.String subscriptionPage, boolean doi, boolean doiPlus, java.lang.String doiMailingKey) throws MaileonException
contact
- the Contact
to create.syncMode
- the SynchronizationMode
determines whether the permission should be updated or ignored if they already exist.src
- the source of the contact if provided.subscriptionPage
- in case where this method was called by a subscription page. If provided, then it offers the possibility to track the contacts for reporting usages.doi
- the doi, default false
. It determines where a double opt-in process should be started for the created contact.doiPlus
- the doi plus, default false
. The same as above, however doi plus will ignored if the parameter doi is set to false
.doiMailingKey
- whether the doi mailing key should be used or not. It is also dependent on the doi parameter (activated or not).MaileonException
- the maileon exceptionpublic void createContactJSON(Contact contact, SynchronizationMode syncMode, java.lang.String src, java.lang.String subscriptionPage, boolean doi, boolean doiPlus, java.lang.String doiMailingKey, boolean useExternalIdasPrimaryID) throws MaileonException
contact
- the Contact
to create.syncMode
- the SynchronizationMode
determines whether the permission should be updated or ignored if they already exist.src
- the source of the contact if provided.subscriptionPage
- in case where this method was called by a subscription page. If provided, then it offers the possibility to track the contacts for reporting usages.doi
- the doi, default false
. It determines where a double opt-in process should be started for the created contact.doiPlus
- the doi plus, default false
. The same as above, however doi plus will ignored if the parameter doi is set to false
.doiMailingKey
- whether the doi mailing key should be used or not. It is also dependent on the doi parameter (activated or not).useExternalIdasPrimaryID
- if true
the externalId will be used as a contact identifier, otherwise the email.MaileonException
- the maileon exceptionpublic Page<Contact> getContacts(java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields, int pageIndex, int pageSize) throws MaileonException
standardFields
- standard properties of the contacts as list of StandardContactField
.customFields
- custom properties of the contacts.pageIndex
- the page index starting from 1.pageSize
- the number of contacts in the page.Contact
objects.MaileonException
- the maileon exceptionpublic Page<Contact> getContactsByFilterId(long contactFilterId, java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields, int pageIndex, int pageSize) throws MaileonException
contactFilterId
- the id of the required filter.standardFields
- standard properties of the contacts as list of StandardContactField
.customFields
- custom properties of the contacts.pageIndex
- the page index starting from 1.pageSize
- the number of contacts in the page.Contact
objects.MaileonException
- the maileon exceptionpublic Contact getContact(java.lang.String email, java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields) throws MaileonException
email
- the email of the searched contacts.standardFields
- standard properties of the contact as list of StandardContactField
.customFields
- custom properties of the contact.Contact
.MaileonException
public Contact getContact(long id, java.lang.String checksum, java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields) throws MaileonException
id
- the maileon contact id.checksum
- the checksum of the maileon contact id to prevent form fields manipulation.standardFields
- standard properties of the contact as list of StandardContactField
.customFields
- custom properties of the contact.Contact
.MaileonException
public java.util.List<Contact> getContactsByExternalId(java.lang.String externalId, java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields) throws MaileonException
externalId
- the externaId to use.standardFields
- standard properties of the contact as list of StandardContactField
.customFields
- custom properties of the contact.Contact
.MaileonException
public void updateContact(Contact contact, java.lang.String checksum, boolean triggerDoi, java.lang.String src, java.lang.String pageKey, java.lang.String doiMailingKey, boolean ignoreChecksum) throws MaileonException
contact
- the Contact
to updatechecksum
- the corresponding checksum of the contact.triggerDoi
- if true
a doi process will be triggered.src
- the source of the contact if provided.pageKey
- in case where this method was called by a landing page. If provided, then it offers the possibility to track the contact for reporting usages or in related
doi processes.doiMailingKey
- whether the doi mailing key should be used or not. whether the doi mailing key should be used or not. It is also dependent on the triggerDoi parameter
(activated or not).ignoreChecksum
- if this flag ist set to true
, the method will ignore the checksum.MaileonException
public void deleteContactsByEmail(java.lang.String email) throws MaileonException
email
- the corresponding email address of the contact.MaileonException
public void deleteContactsByExternalId(java.lang.String externalId) throws MaileonException
externalId
- the corresponding external contact id.MaileonException
public void deleteContactsByMaileonId(long contactId) throws MaileonException
contactId
- the maileon contact idMaileonException
public Page<BlockedContact> getBlockedContacts(java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields, int pageIndex, int pageSize) throws MaileonException
standardFields
- standard properties of the contact as list of StandardContactField
.customFields
- custom properties of the contact.pageIndex
- the page index starting from 1.pageSize
- the number of contacts in the page.BlockedContact
objects.MaileonException
public java.util.List<FieldBackupInstruction> getFieldBackupInstructions() throws MaileonClientException, MaileonException
FieldBackupInstruction
objects.MaileonClientException
MaileonException
public void createBackupInstruction(FieldBackupInstruction fbi) throws MaileonException
fbi
- the FieldBackupInstruction
encapsulating the fields/setting of the backup.MaileonException
public void deleteBackupInstruction(long id) throws MaileonException
id
- the id of the backup instruction.MaileonException
public void deleteBackupInstructions() throws MaileonException
MaileonException
public void deleteStandardFieldValues(StandardContactField field) throws MaileonException
field
- the required standard field.MaileonException
public void deleteCustomFieldValues(java.lang.String field) throws MaileonException
field
- the required custom fieldMaileonException
public java.util.List<Contact> getContactsByEmail(java.lang.String email, java.util.List<StandardContactField> standardFields, java.util.List<java.lang.String> customFields) throws MaileonException
email
- the email of the searched contacts.standardFields
- standard properties of the contact as list of StandardContactField
.customFields
- custom properties of the contact.Contact
.MaileonException
public void deleteCustomField(java.lang.String field) throws MaileonException
field
- name of contact fieldMaileonException
public java.util.List<CustomContactFieldDefinition> getCustomFields() throws MaileonException
CustomContactFieldDefinition
.MaileonException
public void createCustomField(java.lang.String name, java.lang.String type) throws MaileonException
name
- name of contact fieldtype
- string / integer / float / date / booleanMaileonException
public void renameCustomField(java.lang.String oldName, java.lang.String newName) throws MaileonException
oldName
- old name of contact field.newName
- new name of contact field.MaileonException
public void unsubscribeContactsByEmail(java.lang.String email) throws MaileonException
email
- of contacts to unsubsribe.MaileonException
public void unsubscribeContactByEmailFromMultipleAccounts(java.lang.String email, java.util.List<java.lang.Long> nlAccountIds) throws MaileonException
email
- of the contact to unsubsribe.nlAccountIds
- the id of purpose newsletter accountsMaileonException
public void unsubscribeContactById(int contactId) throws MaileonException
contactId
- the given maileon contact id.MaileonException
public void unsubscribeContactByExternalId(java.lang.String externalId) throws MaileonException
externalId
- the provided external contact id.MaileonException
Copyright © 2017. All Rights Reserved.