How filter a http response with MailChimp API V3 ? I'm working in NodeJS. I'm trying to filter the response of my "GET" request in MailChimp API.
Here my snippet.js :
var getList ="https://us18.api.mailchimp.com/3.0/lists/6b3d443365/members"
request({
url: getList,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'apikey ' + password
},
fields: ["id"], // I have also tried: "Fields"
}, function(err, res, body) {
if (err) {
return console.log("err:", err)
}
console.log("connection succeed");
console.log("res: ", body)
});
I have tried also :
1-
fields:["members.id", "members.email_adress"]
2-
fields:"id"
res :
BIG BUNCH of data
all my tentative fails, my console returns me a big bunch with all the data in. I want to filter it but I don't have a clue how to make it. The documentation affirm :
Query string parameters
fields:
Type: Array
Title: Fields
Read only: false
A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
It seems to me I have followed the notice, so, what's going wrong ?
The documentation does in fact say that the 'fields' parameter is
A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
https://mailchimp.com/developer/reference/automation/
The key information that is missing is that you need to prefix each field with a (redundant) reference to the root object.
/3.0/automations?fields=automations.id,automations.settings.title