Open khurramar opened 6 years ago
Would you please post the code that defines the params
being passed into the mailchimp.cfc
function?
Oh, please excuse me @kevindb for a very delayed response.
I actually didn't use the params argument in any of the functions I worked with. But it used to throw error because mailchimp.cfc adds a default parameter exclude_fields=_links in the params. The issue was that the statement which adds the default parameter is written as below
line #321 arguments.params.exclude_fields = "_links";
Doing this way will always add the key exclude_fields in caps, as EXCLUDE_FIELDS, that took a good time of mine as there was no reference at mailchimp's docs if it's case sensitive. I could have fix this statement as below
arguments.params["exclude_fields"] = "_links";
which will indeed keep the key in the format I write it in. But after looking at the mailchimp's api reference where they seem to be expecting all the keys in small letters (in example codes), I switched the code at line no 325. So all the keys turn to small letters before sending over to mailchimp. That couldn't be a good idea either. but it depends, if you expect the developer to pass the key as mailchimp expects, forget the change at line no 325. Do the change at line no. 321 and let the developer decide about its keys. Exactly as you asked me, how did I define the params to pass into mailchimp.cfc.
Hope this clarifies.
Adobe ColdFusion 10 default parameter EXCLUDE_FIELDS=_links was not working as it was being passed in capital letters. turning it into small letters exclude_fields=_links worked.
mailchimp.cfc line: 325 original
response = listAppend(response, key & "=" & urlEncodedFormat(arguments.params[key]), "&");
changedresponse = listAppend(response, lcase(key) & "=" & urlEncodedFormat(arguments.params[key]), "&");
Note: I am not yet fully aware of the mailchimp API as if it may need some parameters in mixed (lower/upper case) letters. In that case, this fix may lead to other issues as mailchimp API appears to be case sensitive.