Open collinhaines opened 7 years ago
Looks like we missed some functionality because MailChimp's API uses same endpoint for updating a segment and adding members to a segment.
MailchimpLists->updateSegment() is based on this documentation
The difference is this line specifies the PATCH method instead of POST, which would be used to add or remove members.
So we could use new functions. How do MailchimpLists->addSegmentMembers($members)
and MailchimpLists->removeSegmentMembers($members)
sound?
I just noticed issue #60 needs the same solution.
Apart from the POST and PATCH problem, I also noticed converting to an object seemed flawed. View #59 for how I solved the problem.
According to the documentation for adding/removing users to a static segment the parameters
members_to_add
andmembers_to_remove
are the only (optional) parameters to be used towards this execution.The only assured parameter is the name of the segment - which should only be passed in when creating a new segment.
I've noticed this using Drupal 7.55 and MailChimp 7.x-4.8.
When attempting to rewrite the
mailchimp_segment_batch_add_subscribers()
function to have the proper parameters as specified in the above documentation I was returned with zero errors and zero successes.Logging
Mailchimp->handleRequest()
returns the following: