1
Vote

listBatchSubscribe returning Error Count :0 and Success Count :0

description

I am new to mailchimp API , i want to add users to a group. I am using listBatchSubscribe class for subscribing. but in listbatchoutput i am getting Success Count : 0 and Error Count : 0. My code is written below. please help me if i am wrong anywhere.Thanks in Advance; listBatchSubscribeInput input = new listBatchSubscribeInput(); input.api_AccessType = PerceptiveMCAPI.EnumValues.AccessType.Serial; input.api_CustomErrorMessages = true; //input.parms.send_welcome = true; input.parms.update_existing = false; input.parms.replace_interests = true; input.parms.double_optin = false; var emailArray = new Dictionary(); emailArray.Add("EMAIL", "abc.xyz@abc.com"); var fnameArray = new Dictionary(); fnameArray.Add("FNAME", "TEST"); var lnameArray = new Dictionary(); lnameArray.Add("LNAME", "TEST"); var array1 = new Dictionary(); array1.Add("name", "TestGroup"); array1.Add("groups", "Val1, Val2"); var array2 = new Dictionary(); array2.Add("id", "21"); array2.Add("groups", "Val1"); var ar21 = new List(); ar21.Add(array1); ar21.Add(array2); var groupingArray = new Dictionary(); groupingArray.Add("GROUPINGS", ar21); var batchArray = new List(); batchArray.Add(emailArray); batchArray.Add(fnameArray); batchArray.Add(lnameArray); batchArray.Add(groupingArray); input.parms.batch = batchArray; input.parms.double_optin = true; input.parms.replace_interests = true; //input.parms.update_existing = true; input.api_MethodType = PerceptiveMCAPI.EnumValues.MethodType.POST; input.api_Validate = true; input.api_OutputType = PerceptiveMCAPI.EnumValues.OutputType.XML; input.parms.apikey = "60ece16f0432a05ff3cfe867aa750e3f-us6"; // input.EnumValues.grouping_type_field = "obituary free (trial)"; input.parms.id = "abc"; listBatchSubscribe bSubscribe = new listBatchSubscribe(input); listBatchSubscribeOutput bOutPut = bSubscribe.Execute();

comments

hulvei3 wrote Jan 27, 2013 at 8:56 AM

Hi

For starters you should not place this as a issue, unless you're sure that this is an issue.

Anyway, you should make only one Dictionary per subscriber. That is, one Dic<> with all the keys with information of that specific subscriber. Now you are trying to add 4 subscribers were only one has an EMAIL attribute, one has the FNAME attr and etc.
            var batchArray = new List();

            var emailArray = new Dictionary();
            emailArray.Add("EMAIL", "abc.xyz@abc.com");
            emailArray.Add("FNAME", "TEST");
            emailArray.Add("LNAME", "TEST");

            batchArray.Add(emailArray);

            // add more users

            input.parms.batch = batchArray;
this is not runnable code - just for show :)

wrote Feb 21, 2013 at 10:55 PM