Address Book¶
-
class
dotmailer.address_books.
AddressBook
(**kwargs)¶ - name: The name of the address book you’re creating, which
- needs to be included within the request body. It can’t be an existing address book’s name, ‘Test’ or ‘All contacts’. There is a limit of 128 characters.
- visibility: All address books are created as ‘Private’ by
- default but you can set it as ‘Public’ upon creation should you wish to. This needs to be included within the request body.
-
add_contact
(contact)¶ Adds a contact to a given address book
Parameters: contact – Returns:
-
create
()¶ Creates an address book. If the current instance is associated with a DotMailer ID then an exception will be raised.
Returns:
-
classmethod
delete
(id)¶ Deletes an address book by ID
Parameters: id – Returns:
-
delete_all_contacts
()¶ Deletes all contacts from a given address book
Returns:
-
delete_contact
(contact)¶ Deletes a contact from a given address book
Parameters: contact – Returns:
-
delete_multiple_contacts
(id_list)¶ Deletes multiple contacts from an address book
Parameters: id_list – Returns:
-
classmethod
get_all
(address_book_type='All')¶ Automatically performs all the requests needed to return every single address book associated with your account. This fucntion wraps the :get_multiple: address book function and continues to ask for more address books until either none are returned or the list returned is shorter than the number being requested.
Parameters: address_book_type – Either ‘All’, ‘Private’ or ‘Public’, depending on if you want every address book, all your private or all your public address books. :return:
-
classmethod
get_by_id
(id)¶ Gets an address book by it’s ID
Parameters: id – The ID of the address book Returns:
-
classmethod
get_multiple
(select=1000, skip=0)¶ Gets all address books within the specified limits. This function performs a query to return all the address books, limited by the select and skip values. To easily get all the address books associated with the account call
get_all()
.Parameters: select – The select parameter requires a number between 1 and 1000 (0 is not a valid number). You may only select a maximum of 1000 results in a single request. This parameter goes within the URL. :param skip: The skip parameter should be used in tandem with the select parameter when wanting to iterate through a whole data set. If you want to select the next 1000 records you should set the select parameter to 1000 and the skip parameter to 1000, which will return records 1001 to 2000. You should continue to do this until 0 records are returned to retrieve the whole data set. This parameter goes within the URL. :return:
-
classmethod
get_private
(select=1000, skip=0)¶ Gets all private address books
Parameters: - select –
- skip –
Returns:
-
classmethod
get_public
(select=1000, skip=0)¶ Gets all public address books
Parameters: - select –
- skip –
Returns:
-
update
()¶ Updates an address book. If either the name is invalid or the instance doesn’t have a DotMailer ID associated with it, then an exception will be raised.
Returns:
-
static
valid_name
(value)¶ Function to help determine if the name value specified is a valid based upon DotMailer’s specification
Parameters: value – The name for an address book which should be validated
Returns: A boolean value indicating if the value given is valid