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 |
|---|---|---|
| filesByNameDelete() | DELETE /files/{name} | Delete File |
| filesByNameGet() | GET /files/{name} | Download File |
| filesByNameInfoGet() | GET /files/{name}/info | Load File Details |
| filesGet() | GET /files | List Files |
| filesPost() | POST /files | Upload File |
filesByNameDelete()filesByNameDelete($name)
Delete File
Permanently deletes the file from your Account. Required Access Level: ModifyFiles
<?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\FilesApi(
// 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 = filename.txt; // string | Name of your file including extension.
try {
$apiInstance->filesByNameDelete($name);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->filesByNameDelete: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of your file including extension. |
void (empty response body)
[Back to top] [Back to API list] [Back to Model list] [Back to README]
filesByNameGet()filesByNameGet($name): \SplFileObject
Download File
Gets content of the specified File. Required Access Level: ViewFiles
<?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\FilesApi(
// 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 = filename.txt; // string | Name of your file including extension.
try {
$result = $apiInstance->filesByNameGet($name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->filesByNameGet: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of your file including extension. |
\SplFileObject
application/*[Back to top] [Back to API list] [Back to Model list] [Back to README]
filesByNameInfoGet()filesByNameInfoGet($name): \ElasticEmail\Model\FileInfo
Load File Details
Returns the specified File's details. Required Access Level: ViewFiles
<?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\FilesApi(
// 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 = filename.txt; // string | Name of your file including extension.
try {
$result = $apiInstance->filesByNameInfoGet($name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->filesByNameInfoGet: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | Name of your file including extension. |
application/json[Back to top] [Back to API list] [Back to Model list] [Back to README]
filesGet()filesGet($limit, $offset): \ElasticEmail\Model\FileInfo[]
List Files
Returns a list of all your available files. Required Access Level: ViewFiles
<?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\FilesApi(
// 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
);
$limit = 100; // int | Maximum number of returned items.
$offset = 20; // int | How many items should be returned ahead.
try {
$result = $apiInstance->filesGet($limit, $offset);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->filesGet: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| limit | int | Maximum number of returned items. | [optional] |
| offset | int | How many items should be returned ahead. | [optional] |
\ElasticEmail\Model\FileInfo[]
application/json[Back to top] [Back to API list] [Back to Model list] [Back to README]
filesPost()filesPost($file_payload, $expires_after_days): \ElasticEmail\Model\FileInfo
Upload File
Uploads selected file to the server. Required Access Level: ModifyFiles
<?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\FilesApi(
// 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
);
$file_payload = new \ElasticEmail\Model\FilePayload(); // \ElasticEmail\Model\FilePayload
$expires_after_days = 56; // int | After how many days should the file be deleted.
try {
$result = $apiInstance->filesPost($file_payload, $expires_after_days);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->filesPost: ', $e->getMessage(), PHP_EOL;
}
| Name | Type | Description | Notes |
|---|---|---|---|
| file_payload | \ElasticEmail\Model\FilePayload | ||
| expires_after_days | int | After how many days should the file be deleted. | [optional] |
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?