向 PHP 的 Mailchimp API 请求添加查询参数

问题描述

我目前正在关注此处看到的文档:https://mailchimp.com/developer/marketing/api/list-members/list-members-info/ 使用 PHP 示例:

$response = $client->lists->getList("list_id");

这返回得很好。但我想添加“unsubscribed_since”查询参数。 如何格式化查询参数? 我试过了:

$response = $mailchimp->lists->getListMembersInfo("id",array('unsubscribed_since' => '2020-01-01'));

还有:

$response = $mailchimp->lists->getListMembersInfo("3d65de82df",['unsubscribed_since' => '2020-01-01']);

任何帮助将不胜感激。

解决方法

我对 count 参数有类似的问题。查看代码,我发现 getListMembersInfo 方法的以下定义:

public function getListMembersInfo($list_id,$fields = null,$exclude_fields = null,$count = '10',$offset = '0',$email_type = null,$status = null,$since_timestamp_opt = null,$before_timestamp_opt = null,$since_last_changed = null,$before_last_changed = null,$unique_email_id = null,$vip_only = null,$interest_category_id = null,$interest_ids = null,$interest_match = null,$sort_field = null,$sort_dir = null,$since_last_campaign = null,$unsubscribed_since = null)

使用附加参数调用方法解决了我的问题。