elasticemail/elasticemail-php

Elastic Email REST API 的 PHP 库。此 API 基于 REST API 架构,允许用户通过基于资源的这种方法轻松管理其数据。要开始使用此 API,您需要您的访问令牌。请记住要妥善保管。

4.0.24 2024-07-08 09:11 UTC

This package is auto-updated.

Last update: 2024-09-08 09:27:14 UTC


README

此 API 基于 REST API 架构,允许用户通过基于资源的这种方法轻松管理其数据。

每个 API 调用都基于将使用哪种特定请求类型(GET、POST、PUT、DELETE)。

API 的并发连接限制为 20 个,每个请求的超时时间为 600 秒。

要开始使用此 API,您需要您的访问令牌(可在此处找到)。请记住要妥善保管。所需的访问级别在给定请求的说明中列出。

可下载的库客户端可以在我们的 GitHub 存储库此处找到

安装 & 使用

要求

PHP 7.4 及更高版本。也应在 PHP 8.0 中运行。

Composer

要通过 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/elasticemail/elasticemail-php.git"
    }
  ],
  "require": {
    "elasticemail/elasticemail-php": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/ElasticEmail/vendor/autoload.php');

入门指南

请按照安装过程进行操作,然后运行以下命令

<?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;
}

示例

API 端点

所有 URI 都相对于 https://api.elasticemail.com/v4

模型

授权

API定义的认证方案

apikey

  • 类型: API密钥
  • API密钥参数名称: X-ElasticEmail-ApiKey
  • 位置: HTTP头

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

support@elasticemail.com

关于此包

此PHP包是由OpenAPI Generator项目自动生成的

  • API版本: 4.0.0
    • 包版本: 4.0.24
    • 生成器版本: 7.7.0
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen