Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Is Count Parameter Ignored For GETs In A Batch? #75

Open
GodsBest opened this issue Jun 14, 2021 · 1 comment
Open

Why Is Count Parameter Ignored For GETs In A Batch? #75

GodsBest opened this issue Jun 14, 2021 · 1 comment

Comments

@GodsBest
Copy link

Each of the following returns more than 10 members, as expected:

mailchimp.request({method:'GET',path:`/list/${list_id}/segments/${segment_id}/members`, query: {count: 1000}})....;
//or
mailchimp.get(`/lists/${list_id}/segments/${segment_id}/members?count=1000`)....;

However, the following only returns at most 10 segment members, per segment even though total_items is greater than 10:

mailchimp.batch([
    {method:'GET',path:`/lists/${list_id}/segments/${segment_id_1}/members`, query: {count:1000}},
    {method:'GET',path:`/lists/${list_id}/segments/${segment_id_2}/members`, query: {count:1000}},
    {method:'GET',path:`/lists/${list_id}/segments/${segment_id_3}/members`, query: {count:1000}},
    {method:'GET',path:`/lists/${list_id}/segments/${segment_id_4}/members`, query: {count:1000}},
    {method:'GET',path:`/lists/${list_id}/segments/${segment_id_5}/members`, query: {count:1000}}
])....;

Even when count is set to a value lower than 10, each still returns 10 items.

It appears that count is ignored altogether. Not so with other parameters such as:

include_cleaned
include_unsubscribed

Why is count being ignored?

See No More than 10 Segment Members in A Batch Call with mailchimp-api-v3

@GodsBest GodsBest changed the title Why Is Count Parameter Ignored For Gets In A Batch? Why Is Count Parameter Ignored For GETs In A Batch? Jun 14, 2021
@arifmahmudrana
Copy link

This is also happening for the /growth-history API call e.g when calling

const res: GrowthHistoryResponse = await mailchimpClient.get(
  `/lists/${process.env.MAILCHIMP_LIST_ID}/growth-history`,
  'count=10',
);

The result is

{
  history: [],
  list_id: 'list_id',
  total_items: 0,
  _links: [
    {
      rel: 'self',
      href: 'https://us14.api.mailchimp.com/3.0/lists/list_id/growth-history',
      method: 'GET',
      targetSchema: 'https://us14.api.mailchimp.com/schema/3.0/Definitions/Lists/Growth/CollectionResponse.json',
      schema: 'https://us14.api.mailchimp.com/schema/3.0/Paths/Lists/Growth/Collection.json'
    },
    {
      rel: 'parent',
      href: 'https://us14.api.mailchimp.com/3.0/lists/list_id/',
      method: 'GET',
      targetSchema: 'https://us14.api.mailchimp.com/schema/3.0/Definitions/Lists/Response.json'
    }
  ],
  statusCode: 200
}

Whenever passing query params it's not working but when appending with the path then it works

const res: GrowthHistoryResponse = await mailchimpClient.get(
  `/lists/${process.env.MAILCHIMP_LIST_ID}/growth-history?count=12`,
);

Even using

const res: GrowthHistoryResponse = await mailchimpClient.get(
  {
    path: `/lists/${process.env.MAILCHIMP_LIST_ID}/growth-history`,
    query: params.toString(),
  },
);

returns empty result

{
  "history": [],
  "list_id": "list_id",
  "total_items": 0,
  "_links": [
    {
      "rel": "self",
      "href": "https://us14.api.mailchimp.com/3.0/lists/list_id/growth-history",
      "method": "GET",
      "targetSchema": "https://us14.api.mailchimp.com/schema/3.0/Definitions/Lists/Growth/CollectionResponse.json",
      "schema": "https://us14.api.mailchimp.com/schema/3.0/Paths/Lists/Growth/Collection.json"
    },
    {
      "rel": "parent",
      "href": "https://us14.api.mailchimp.com/3.0/lists/list_id/",
      "method": "GET",
      "targetSchema": "https://us14.api.mailchimp.com/schema/3.0/Definitions/Lists/Response.json"
    }
  ],
  "statusCode": 200
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants