1

我正在使用 Mailchimp 的营销 PHP API ( https://github.com/mailchimp/mailchimp-marketing-php ) 来检索模板列表。它有以下代码。

<?php
require_once '/path/to/MailchimpMarketing/vendor/autoload.php';

$client = new MailchimpMarketing\ApiClient();
$client->setConfig([
    'apiKey' => 'YOUR_API_KEY',
    'server' => 'YOUR_SERVER_PREFIX',
]);

$response = $client->templates->list();
print_r($response);

并且它返回整套其他默认模板(128 个模板!),api 请求参数具有type可用于过滤这些模板的字段。但是我无论如何都找不到传递请求参数。任何想法?

4

1 回答 1

0

我不确定这是否是正确的方法,但在浏览 API 库源代码后,我找到了包含请求参数的正确函数。

<?php
require_once '/path/to/MailchimpMarketing/vendor/autoload.php';

$client = new MailchimpMarketing\ApiClient();
$client->setConfig([
    'apiKey' => 'YOUR_API_KEY',
    'server' => 'YOUR_SERVER_PREFIX',
]);

$response = $this->client->templates->listWithHttpInfo($fields = null, $exclude_fields = null, $count = '10', $offset = '0', $created_by = null, $since_created_at = null, $before_created_at = null, $type = 'user', $category = null, $folder_id = null, $sort_field = null);

print_r($response);
于 2020-10-18T09:14:57.957 回答