John Davidson

Adding Query Parameters to Mailchimp API request for PHP

0 comments
Message:


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.



My Answer:
>get('lists/{list_id}/members', [
'query' => [
'count' => 10,
'offset' => 0
]
]);In this example, we are adding query parameters 'count' and 'offset' to the API request. The 'count' parameter specifies the number of members to return, and the 'offset' parameter specifies the starting index of the members to return. You can add more query parameters as needed for your specific use case.

Rate this post

4 of 5 based on 8844 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us