Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.83 KB

loadList.md

File metadata and controls

66 lines (45 loc) · 1.83 KB

Load List

This guide will walk you through the process of loading details about contacts list on your account using the PHP library.

Required Access Level: ViewContacts

What statistics are returned?

When using Elastic Email you send email campaigns to your contacts. From that we create statistics reports for you eg. number of emails sent, number of delivered messages,Number of opened messages, number of unsubscribed messages, number of clicked messages etc.

Let's dig into the code

Put the below code to your file.

Load library using below line:

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

Generate and use your API key (remember to check a required access level):

define('MY_APIKEY', 'YOUR_API_KEY');
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', MY_APIKEY);

Create an instance of StatisticsApi that will be used to get basic send statistics.

$apiInstance = new ElasticEmail\Api\StatisticsApi(
    new GuzzleHttp\Client(),
    $config
);

The only thing needed is a list name.

Find out more by checking our API's documentation: https://elasticemail.com/developers/api-documentation/rest-api#operation/statisticsChannelsGet

$name = "My New List";
$response = $apiInstance->listsByNameGet($name);

The whole code to copy and paste: