elasticemail/elasticemail-php
PHP client for Elastic Email’s REST API. Authenticate with your API key and manage campaigns and other resources via GET/POST/PUT/DELETE. Supports PHP 7.4+ (incl. 8.0) and uses Guzzle with configurable timeouts and connection limits.
All URIs are relative to https://api.elasticemail.com/v4, except if the operation defines another base path.
| Method | HTTP request | Description |
|---|---|---|
| campaignsByNameDelete() | DELETE /campaigns/{name} | Delete Campaign |
| campaignsByNameGet() | GET /campaigns/{name} | Load Campaign |
| campaignsByNamePausePut() | PUT /campaigns/{name}/pause | Pause Campaign |
| campaignsByNamePut() | PUT /campaigns/{name} | Update Campaign |
| campaignsGet() | GET /campaigns | Load Campaigns |
| campaignsPost() | POST /campaigns | Add Campaign |
campaignsByNameDelete()campaignsByNameDelete($name)
Delete Campaign
Delete the specific campaign. This does not cancel in progress email, see Cancel In Progress. Required Access Level: ModifyCampaigns
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-ElasticEmail-ApiKey', 'Bearer');
$apiInstance = new ElasticEmail\Api\CampaignsApi(
// 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
);
$name = 'name_example'; // string | Name of Campaign to delete
try {
$apiInstance->campaignsByNameDelete($name);
} catch (Exception $e) {
echo 'Exception when calling CampaignsApi->campaignsByNameDelete: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of Campaign to delete |
void (empty response body)
[Back to top] [Back to API list] [Back to Model list] [Back to README]
campaignsByNameGet()campaignsByNameGet($name): \ElasticEmail\Model\Campaign
Load Campaign
Returns the specified campaign details. Required Access Level: ViewCampaigns
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-ElasticEmail-ApiKey', 'Bearer');
$apiInstance = new ElasticEmail\Api\CampaignsApi(
// 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
);
$name = 'name_example'; // string | Name of Campaign to get
try {
$result = $apiInstance->campaignsByNameGet($name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CampaignsApi->campaignsByNameGet: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of Campaign to get |
application/json[Back to top] [Back to API list] [Back to Model list] [Back to README]
campaignsByNamePausePut()campaignsByNamePausePut($name)
Pause Campaign
Pauses the specific campaign, cancelling emails that are waiting to be sent. Required Access Level: ModifyCampaigns
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-ElasticEmail-ApiKey', 'Bearer');
$apiInstance = new ElasticEmail\Api\CampaignsApi(
// 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
);
$name = 'name_example'; // string | Name of Campaign to pause
try {
$apiInstance->campaignsByNamePausePut($name);
} catch (Exception $e) {
echo 'Exception when calling CampaignsApi->campaignsByNamePausePut: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of Campaign to pause |
void (empty response body)
[Back to top] [Back to API list] [Back to Model list] [Back to README]
campaignsByNamePut()campaignsByNamePut($name, $campaign): \ElasticEmail\Model\Campaign
Update Campaign
Updates a previously added campaign. Only Active and Paused campaigns can be updated. Required Access Level: ModifyCampaigns
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-ElasticEmail-ApiKey', 'Bearer');
$apiInstance = new ElasticEmail\Api\CampaignsApi(
// 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
);
$name = 'name_example'; // string | Name of Campaign to update
$campaign = new \ElasticEmail\Model\Campaign(); // \ElasticEmail\Model\Campaign | JSON representation of a campaign
try {
$result = $apiInstance->campaignsByNamePut($name, $campaign);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CampaignsApi->campaignsByNamePut: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of Campaign to update | |
| campaign | \ElasticEmail\Model\Campaign | JSON representation of a campaign |
application/jsonapplication/json[Back to top] [Back to API list] [Back to Model list] [Back to README]
campaignsGet()campaignsGet($search, $offset, $limit): \ElasticEmail\Model\Campaign[]
Load Campaigns
Returns a list all of your campaigns. Limited to 1000 results. Required Access Level: ViewCampaigns
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-ElasticEmail-ApiKey', 'Bearer');
$apiInstance = new ElasticEmail\Api\CampaignsApi(
// 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 | Text fragment used for searching in Campaign name (using the 'contains' rule)
$offset = 20; // int | How many items should be returned ahead.
$limit = 100; // int | Maximum number of returned items.
try {
$result = $apiInstance->campaignsGet($search, $offset, $limit);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CampaignsApi->campaignsGet: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| search | string | Text fragment used for searching in Campaign name (using the 'contains' rule) | [optional] |
| offset | int | How many items should be returned ahead. | [optional] |
| limit | int | Maximum number of returned items. | [optional] |
\ElasticEmail\Model\Campaign[]
application/json[Back to top] [Back to API list] [Back to Model list] [Back to README]
campaignsPost()campaignsPost($campaign): \ElasticEmail\Model\Campaign
Add Campaign
Add a campaign for processing. Required Access Level: ModifyCampaigns
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
$config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKey('X-ElasticEmail-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ElasticEmail\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-ElasticEmail-ApiKey', 'Bearer');
$apiInstance = new ElasticEmail\Api\CampaignsApi(
// 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
);
$campaign = new \ElasticEmail\Model\Campaign(); // \ElasticEmail\Model\Campaign | JSON representation of a campaign
try {
$result = $apiInstance->campaignsPost($campaign);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CampaignsApi->campaignsPost: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| campaign | \ElasticEmail\Model\Campaign | JSON representation of a campaign |
application/jsonapplication/json[Back to top] [Back to API list] [Back to Model list] [Back to README]
How can I help you explore Laravel packages today?