Skip to content

Latest commit

 

History

History
564 lines (387 loc) · 16.8 KB

File metadata and controls

564 lines (387 loc) · 16.8 KB

MailMojo\ContactApi

All URIs are relative to http://api.mailmojo.no, except if the operation defines another base path.

Method HTTP request Description
getContactByEmail() GET /v1/contacts/{email}/ Retrieve a contact in any list by email.
getContacts() GET /v1/contacts/ Retrieve all contacts across every list.
getHistoricalContactStats() GET /v1/contacts/stats/ Retrieve historical stats over contacts across every list.
getSubscriberOnListByEmail() GET /v1/lists/{list_id}/subscribers/{email}/ Retrieve a subscriber.
getSubscribersOnList() GET /v1/lists/{list_id}/subscribers/ Retrieve subscribers on a list.
getUnsubscribedOnList() GET /v1/lists/{list_id}/unsubscribed/ Retrieve unsubscribed contacts on a list.
subscribeContactToList() POST /v1/lists/{list_id}/subscribers/ Subscribe a contact to the email list.
unsubscribeContactOnListByEmail() DELETE /v1/lists/{list_id}/subscribers/{email}/ Unsubscribe a contact.
updateContact() PATCH /v1/contacts/{email}/ Update details about a contact.

getContactByEmail()

getContactByEmail($email): \MailMojo\Model\Contact

Retrieve a contact in any list by email.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$email = 'email_example'; // string

try {
    $result = $apiInstance->getContactByEmail($email);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->getContactByEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
email string

Return type

\MailMojo\Model\Contact

Authorization

mailmojo_auth

HTTP request headers

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

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

getContacts()

getContacts($search, $limit, $offset): \MailMojo\Model\Contact[]

Retrieve all contacts across every list.

This endpoint returns contacts across every list on the account. Use limit and offset query parameters to paginate large datasets.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$search = 'search_example'; // string | Filter by partial email address or name.
$limit = 56; // int | Limits the result to given count.
$offset = 56; // int | Skips the given count of contacts before returning results.

try {
    $result = $apiInstance->getContacts($search, $limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->getContacts: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
search string Filter by partial email address or name. [optional]
limit int Limits the result to given count. [optional]
offset int Skips the given count of contacts before returning results. [optional]

Return type

\MailMojo\Model\Contact[]

Authorization

mailmojo_auth

HTTP request headers

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

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

getHistoricalContactStats()

getHistoricalContactStats($start_date): \MailMojo\Model\HistoricalContactsStats[]

Retrieve historical stats over contacts across every list.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$start_date = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | The starting date to include stats from.

try {
    $result = $apiInstance->getHistoricalContactStats($start_date);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->getHistoricalContactStats: ', $e->getMessage(), PHP_EOL;
}

Parameters

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

Return type

\MailMojo\Model\HistoricalContactsStats[]

Authorization

mailmojo_auth

HTTP request headers

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

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

getSubscriberOnListByEmail()

getSubscriberOnListByEmail($list_id, $email): \MailMojo\Model\Subscriber

Retrieve a subscriber.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$list_id = 56; // int | ID of the email list to retrieve the subscriber from.
$email = 'email_example'; // string | Email address of the contact to retrieve.

try {
    $result = $apiInstance->getSubscriberOnListByEmail($list_id, $email);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->getSubscriberOnListByEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

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

Return type

\MailMojo\Model\Subscriber

Authorization

mailmojo_auth

HTTP request headers

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

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

getSubscribersOnList()

getSubscribersOnList($list_id, $search, $limit, $offset): \MailMojo\Model\Subscriber[]

Retrieve subscribers on a list.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$list_id = 56; // int | ID of the email list.
$search = 'search_example'; // string | Filter by partial email address or name.
$limit = 56; // int | Limits the result to given count.
$offset = 56; // int | Skips the given count of contacts before returning results.

try {
    $result = $apiInstance->getSubscribersOnList($list_id, $search, $limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->getSubscribersOnList: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
list_id int ID of the email list.
search string Filter by partial email address or name. [optional]
limit int Limits the result to given count. [optional]
offset int Skips the given count of contacts before returning results. [optional]

Return type

\MailMojo\Model\Subscriber[]

Authorization

mailmojo_auth

HTTP request headers

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

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

getUnsubscribedOnList()

getUnsubscribedOnList($list_id, $limit, $offset): \MailMojo\Model\Contact[]

Retrieve unsubscribed contacts on a list.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$list_id = 56; // int | ID of the email list.
$limit = 56; // int | Limits the result to given count.
$offset = 56; // int | Skips the given count of contacts before returning results.

try {
    $result = $apiInstance->getUnsubscribedOnList($list_id, $limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->getUnsubscribedOnList: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
list_id int ID of the email list.
limit int Limits the result to given count. [optional]
offset int Skips the given count of contacts before returning results. [optional]

Return type

\MailMojo\Model\Contact[]

Authorization

mailmojo_auth

HTTP request headers

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

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

subscribeContactToList()

subscribeContactToList($list_id, $contact): \MailMojo\Model\Contact

Subscribe a contact to the email list.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$list_id = 56; // int | ID of the email list to subscribe to.
$contact = new \MailMojo\Model\Subscriber(); // \MailMojo\Model\Subscriber

try {
    $result = $apiInstance->subscribeContactToList($list_id, $contact);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->subscribeContactToList: ', $e->getMessage(), PHP_EOL;
}

Parameters

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

Return type

\MailMojo\Model\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]

unsubscribeContactOnListByEmail()

unsubscribeContactOnListByEmail($list_id, $email): \MailMojo\Model\Contact

Unsubscribe a contact.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$list_id = 56; // int | ID of the email list to unsubscribe from.
$email = 'email_example'; // string | Email address of the contact to unsubscribe.

try {
    $result = $apiInstance->unsubscribeContactOnListByEmail($list_id, $email);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->unsubscribeContactOnListByEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

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

Return type

\MailMojo\Model\Contact

Authorization

mailmojo_auth

HTTP request headers

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

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

updateContact()

updateContact($email, $contact): \MailMojo\Model\BaseContact

Update details about a contact.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: mailmojo_auth
$config = MailMojo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new MailMojo\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$email = 'email_example'; // string | Email address of contact to update.
$contact = new \MailMojo\Model\BaseContact(); // \MailMojo\Model\BaseContact

try {
    $result = $apiInstance->updateContact($email, $contact);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->updateContact: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
email string Email address of contact to update.
contact \MailMojo\Model\BaseContact [optional]

Return type

\MailMojo\Model\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]