Skip to content

Latest commit

 

History

History
477 lines (338 loc) · 15.1 KB

ContactApi.md

File metadata and controls

477 lines (338 loc) · 15.1 KB

mailmojo_sdk.ContactApi

All URIs are relative to https://api.mailmojo.no

Method HTTP request Description
get_contact_by_email GET /v1/contacts/{email}/ Retrieve a contact in any list by email.
get_contacts GET /v1/contacts/ Retrieve all contacts across every list.
get_historical_contact_stats GET /v1/contacts/stats/ Retrieve historical stats over contacts across every list.
get_subscriber_on_list_by_email GET /v1/lists/{list_id}/subscribers/{email}/ Retrieve a subscriber.
get_subscribers_on_list GET /v1/lists/{list_id}/subscribers/ Retrieve subscribers on a list.
get_unsubscribed_on_list GET /v1/lists/{list_id}/unsubscribed/ Retrieve unsubscribed contacts on a list.
subscribe_contact_to_list POST /v1/lists/{list_id}/subscribers/ Subscribe a contact to the email list.
unsubscribe_contact_on_list_by_email DELETE /v1/lists/{list_id}/subscribers/{email}/ Unsubscribe a contact.
update_contact PATCH /v1/contacts/{email}/ Update details about a contact.

get_contact_by_email

Contact get_contact_by_email(email)

Retrieve a contact in any list by email.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
email = 'email_example' # str | 

try:
    # Retrieve a contact in any list by email.
    api_response = api_instance.get_contact_by_email(email)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_contact_by_email: %s\n" % e)

Parameters

Name Type Description Notes
email str

Return type

Contact

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_contacts

list[Contact] get_contacts()

Retrieve all contacts across every list.

This endpoint currently returns all contacts in your account without any pagination and should be considered EXPERIMENTAL. The response schema will change without any warning in the near future to account for pagination.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))

try:
    # Retrieve all contacts across every list.
    api_response = api_instance.get_contacts()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_contacts: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

list[Contact]

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_historical_contact_stats

list[HistoricalContactsStats] get_historical_contact_stats(start_date=start_date)

Retrieve historical stats over contacts across every list.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
start_date = '2013-10-20' # date | The starting date to include stats from. (optional)

try:
    # Retrieve historical stats over contacts across every list.
    api_response = api_instance.get_historical_contact_stats(start_date=start_date)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_historical_contact_stats: %s\n" % e)

Parameters

Name Type Description Notes
start_date date The starting date to include stats from. [optional]

Return type

list[HistoricalContactsStats]

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_subscriber_on_list_by_email

Subscriber get_subscriber_on_list_by_email(list_id, email)

Retrieve a subscriber.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
list_id = 56 # int | ID of the email list to retrieve the subscriber from.
email = 'email_example' # str | Email address of the contact to retrieve.

try:
    # Retrieve a subscriber.
    api_response = api_instance.get_subscriber_on_list_by_email(list_id, email)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_subscriber_on_list_by_email: %s\n" % e)

Parameters

Name Type Description Notes
list_id int ID of the email list to retrieve the subscriber from.
email str Email address of the contact to retrieve.

Return type

Subscriber

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_subscribers_on_list

list[Subscriber] get_subscribers_on_list(list_id, limit=limit)

Retrieve subscribers on a list.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
list_id = 56 # int | ID of the email list.
limit = 56 # int | Limits the result to given count. (optional)

try:
    # Retrieve subscribers on a list.
    api_response = api_instance.get_subscribers_on_list(list_id, limit=limit)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_subscribers_on_list: %s\n" % e)

Parameters

Name Type Description Notes
list_id int ID of the email list.
limit int Limits the result to given count. [optional]

Return type

list[Subscriber]

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_unsubscribed_on_list

list[Contact] get_unsubscribed_on_list(list_id, limit=limit)

Retrieve unsubscribed contacts on a list.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
list_id = 56 # int | ID of the email list.
limit = 56 # int | Limits the result to given count. (optional)

try:
    # Retrieve unsubscribed contacts on a list.
    api_response = api_instance.get_unsubscribed_on_list(list_id, limit=limit)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_unsubscribed_on_list: %s\n" % e)

Parameters

Name Type Description Notes
list_id int ID of the email list.
limit int Limits the result to given count. [optional]

Return type

list[Contact]

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

subscribe_contact_to_list

Contact subscribe_contact_to_list(list_id, contact)

Subscribe a contact to the email list.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
list_id = 56 # int | ID of the email list to subscribe to.
contact = mailmojo_sdk.Subscriber() # Subscriber | 

try:
    # Subscribe a contact to the email list.
    api_response = api_instance.subscribe_contact_to_list(list_id, contact)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->subscribe_contact_to_list: %s\n" % e)

Parameters

Name Type Description Notes
list_id int ID of the email list to subscribe to.
contact Subscriber

Return type

Contact

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

unsubscribe_contact_on_list_by_email

Contact unsubscribe_contact_on_list_by_email(list_id, email)

Unsubscribe a contact.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
list_id = 56 # int | ID of the email list to unsubscribe from.
email = 'email_example' # str | Email address of the contact to unsubscribe.

try:
    # Unsubscribe a contact.
    api_response = api_instance.unsubscribe_contact_on_list_by_email(list_id, email)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->unsubscribe_contact_on_list_by_email: %s\n" % e)

Parameters

Name Type Description Notes
list_id int ID of the email list to unsubscribe from.
email str Email address of the contact to unsubscribe.

Return type

Contact

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_contact

BaseContact update_contact(email, contact=contact)

Update details about a contact.

Example

from __future__ import print_function
import time
import mailmojo_sdk
from mailmojo_sdk.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: mailmojo_auth
configuration = mailmojo_sdk.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = mailmojo_sdk.ContactApi(mailmojo_sdk.ApiClient(configuration))
email = 'email_example' # str | Email address of contact to update.
contact = mailmojo_sdk.BaseContact() # BaseContact |  (optional)

try:
    # Update details about a contact.
    api_response = api_instance.update_contact(email, contact=contact)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->update_contact: %s\n" % e)

Parameters

Name Type Description Notes
email str Email address of contact to update.
contact BaseContact [optional]

Return type

BaseContact

Authorization

mailmojo_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]