retrieve "modified since" list members in v2.0 API (with full member-info)

543 views
Skip to first unread message

Luc Sorel Podbox

unread,
Nov 27, 2013, 11:04:11 AM11/27/13
to mailchimp-...@googlegroups.com
Hello,

In the process of migrating from API version 1.3 to 2.0, I do not find the way to retrieve the members of a list (with full member-info including merge vars and groupings) modified after a given date:
  • in API 1.3, I called listMembers to retrieve basic data of members modified after a given date with the {apikey:"...", since:"2013-12-30 20:30:00"}, start:...} query parameter, and then listMemberInfo a couple of times to retrieve the merge vars. But groupings are not supported in the API version

  • the equivalent method in API 2.0 is lists/members which returns directly the whole member-info in one call (great, thanks!) but does not seem to support the same since request parameter, I tried by putting it in the opts parameter (since it is an optional parameter) like this: {apikey:"...", opts:{since:"2013-12-30 20:30:00", start:...}, ...} but it had no impact on the query result.

Is there anything that I missed to enable the "modified since" behavior in the 2.0 API?

Thanks you in advance for your attention and answer, best regards,
Luc Sorel, PhD - R&D at Podbox

Luc Sorel Podbox

unread,
Nov 27, 2013, 11:12:21 AM11/27/13
to mailchimp-...@googlegroups.com
I also tested {"apikey":"...","since":"2013-11-26 10:25:24", "opts":{...}, ...} but it does not filter the returned members neither.

Nate

unread,
Nov 27, 2013, 12:21:35 PM11/27/13
to mailchimp-...@googlegroups.com
Hey Luc --

Your best bet for this would be to use a segment of your list based on the date you want to use.  There was a post around here recently with some code examples, but I can't seem to find it right now.

Anyway, the campaigns/segment-test method should get you squared away with how structure that segment.

Max Keeler

unread,
Nov 27, 2013, 3:03:24 PM11/27/13
to mailchimp-...@googlegroups.com
Hi,

You may need to use the new export API, here:


Max

Luc Sorel Podbox

unread,
Nov 28, 2013, 5:15:10 AM11/28/13
to mailchimp-...@googlegroups.com
Hi Nate,

Thanks for your answer. I gave segment-test a try but:
  • its last_changed parameter accepts a date instead of a date-time (the v1.3 listMembers since parameter allowed a datetime value) which could have been ok for the data connector I migrate from 1.3 to 2.0
  • this method returns a number of subscribers but, as I mentioned in my post and its title, I need the whole member-info with the merge vars and the groupings

So definitely not a good substitute for the 1.3 listMembers method. Thanks though for the hints you provided! :)

Luc Sorel Podbox

unread,
Nov 28, 2013, 5:41:56 AM11/28/13
to mailchimp-...@googlegroups.com
Hi Max,

Thank you for your answer too. I also gave a try to the export method but:
  • the format of the returned data (a chimerical CSV file of javascript arrays :) !) without metadata (to help distinguishing the labels of merge vars and groupings) make it so painful to process it but that is why we still need developers :)
  • but mostly, it lacks several data fields that were returned by the 1.3 listMember-info method (like email type, signup IP or timestamp)
So using this export method instead of the 1.3 listMembers would cause data loss and regression to the users of our MailChimp connectors :(

Luc Sorel Podbox

unread,
Nov 28, 2013, 6:10:45 AM11/28/13
to mailchimp-...@googlegroups.com
so I believe that unless the MailChimp API team corrects the 2.0 lists/members by restoring the since parameter, I will:
  • call the 1.3 listMembers method with the since parameter to retrieve the updated emails
  • then call the 2.0 lists/member-info by loads of 50 emails to retrieve the merge vars and the groupings

Thanks to the respondents for their inputs, and hopefully the API will evolve to make it backward compatible.

Nate

unread,
Dec 2, 2013, 10:32:21 AM12/2/13
to mailchimp-...@googlegroups.com
Hey again, Luc --

Appreciate the feedback.

I'm not sure I was clear on exactly what I meant by using a segment.  With the lists/member call, you can use a segment based on "date" for date added or "last_changed" for segmenting based on the last time a subscriber's profile was updated.  Using that in conjunction with the lists/members call will let you do something similar to the "since" parameter.  For example, if I wanted to grab a list of all of the subscribers who had been added since November 19th in my list, I'd use the following:

$lid = 'efed60d431';
$status = 'subscribed';
$opts = array(
'start' => 0,
'limit' => 100,
'sort_field' => 'EMAIL',
'sort_dir' => 'ASC',
'segment' => array(
'match' => 'all',
'conditions' => array(
array(
'field' => 'date',
'op' => 'gt',
'value' => '2013-11-19')
)
)
);

$api = new Mailchimp($apikey);
$members = $api->lists->members($lid,$status,$opts);

print_r($members);

That returns only the data for the first 100 subscribers who meet that criteria, and you can page through from there.

If using v1.3 works for now, though, feel free to use that!  Just wanted to provide a more concrete example of what I was talking about.

Cheers

Luc Sorel Podbox

unread,
Dec 2, 2013, 11:19:17 AM12/2/13
to mailchimp-...@googlegroups.com
Hi Nate,


On Monday, December 2, 2013 4:32:21 PM UTC+1, Nate wrote:
Hey again, Luc --

Appreciate the feedback.

I'm not sure I was clear on exactly what I meant by using a segment.  With the lists/member call, you can use a segment based on "date" for date added or "last_changed" for segmenting based on the last time a subscriber's profile was updated.  Using that in conjunction with the lists/members call will let you do something similar to the "since" parameter.  For example, if I wanted to grab a list of all of the subscribers who had been added since November 19th in my list, I'd use the following:
[...]

Ok, now I realize I misunderstood you, thanks for persevering in your explanation. The allusion to the campaigns/segment-test method mislead me, sorry about that :)
Reply all
Reply to author
Forward
0 new messages