首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mailchimp PHP Marketing API传递请求参数

Mailchimp PHP Marketing API传递请求参数
EN

Stack Overflow用户
提问于 2020-10-18 14:43:11
回答 1查看 516关注 0票数 0

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

代码语言:javascript
复制
<?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字段,可以用来过滤这些模板。但是我找不到任何方式来传递请求参数。有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2020-10-18 17:14:58

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

代码语言:javascript
复制
<?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);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64410477

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档