我使用Mailchimp的Marketing PHP (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个模板!),接口请求参数有type字段,可以用来过滤这些模板。但是我找不到任何方式来传递请求参数。有什么想法吗?
发布于 2020-10-18 17:14:58
我不确定这是否是正确的方法,但在查看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);https://stackoverflow.com/questions/64410477
复制相似问题