I have an application that successfully retrieves a subset of field data using the node client library getSegmentMembersList function as below. Whatever I do it returns status 200 with only the default 10 records.
I searched high and low for an answer to this but everything indicates the code below should work. It doesn't. In addition, the API is taking a long time to respond to that endpoint (7 Oct/2023).
//set config
mailchimp.setConfig({
apiKey: process.env.MAILCHIMP_API_KEY,
server: DATACENTER,
});
//try...
const response = await mailchimp.lists.getSegmentMembersList(
AUDIENCE,
SEGMENT,
{
fields: ["members.merge_fields","members.status"],
count: 500,
offset: 0
}
);
console.log('RESPONSE:',response);
I tested using a get request with Thunder Client with query params instead of the node client library exactly as per their documentation.
GET
/lists/{list_id}/segments/{segment_id}/members
In that case, the response with or without query params was:
"title": "Resource Not Found",
"status": 404,
"detail": "Invalid path",
UPDATE: After taking a break I came back and the re-ran exactly the same code. It worked as expected returning more than 10 records. The next time I ran the code it ignored the count parameter again and it has done so ever since.
UPDATE: Thunder Client is no longer returning an error but exhibits the same bug. The count parameter is not respected and only 10 records are returned. What's more it takes between 1.5-3 seconds to return that tiny dataset. Mailchimp support have only responded with automated responses one of which was irrelevant and seemed suspiciously like an AI generated answer.
UPDATE: Just in case this helps anyone else struggling with this, I gave up waiting for Mailchimp support to answer and used a different endpoint. getSegmentMembersList returns more data, which then has to be filtered, but it is faster and behaves as per API documentation.
//try...
const response = await mailchimp.lists.getSegmentMembersList(
AUDIENCE,
{
fields: ["members.merge_fields","members.status"],
count: 500,
offset: 0
}
);
console.log('RESPONSE:',response);