3

I am currently following the documentation seen here: https://mailchimp.com/developer/marketing/api/list-members/list-members-info/ Using the PHP example:

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

This returns just fine. But I would like to add in the 'unsubscribed_since' Query Parameter. How do I format the query parameters? I've tried:

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

As well as:

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

Any help would be appreciated.

Sean
  • 43
  • 4

2 Answers2

4

I had a similar problem with count parameter. Looking into the code I found the following definition of getListMembersInfo method:

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)

Calling the method with the additional parameters solved my problem.

Dharman
  • 30,962
  • 25
  • 85
  • 135
fgaleazzi
  • 56
  • 1
0

Expanding on Dharman's comment, you would need to use:

$response = $mailchimp->lists->getListMembersInfo("3d65de82df", null, null, '10', '0', null, 'unsubscribed', null, null, null, null, null, null, null, null, null, null, null, null, '2020-01-01');

https://mailchimp.com/developer/marketing/api/list-members/list-members-info/ is not very clear.

John Dorner
  • 1,085
  • 1
  • 8
  • 15