Please, before you get too deep into anything, make sure that you've read our Getting Started Guide. Thanks!
Write-ups on some standard use cases that our customers have employed. These range from very basic to kind of complicated solutions for a variety of things:
Think we missed something, or have an example you'd like us to cover? Let us know!
Folks using the serialized version of the API often have problems with exactly how to build-up the URLs. These examples try to spell that out a bit more clearly.
Example 1: Using HTTP GET/POST. Here we'll just create a url that you can use in whatever method you wish to grab the data (curl, wget, raw sockets, etc).
#Return format is a php serialized array
http://<dc>.api.mailchimp.com/1.3/?method=listMemberInfo
&apikey=<apikey - captured from your API dashboard>
&id=<list id - captured from lists()>
&email_address=<email_address>
&merge_vars=
&output=php
#Return format is a JSON objects
http://<dc>.api.mailchimp.com/1.3/?method=listMemberInfo
&apikey=<apikey - captured from your API dashboard>
&id=<list id - captured from lists()>
&email_address=<email_address>
&merge_vars=
&output=json
Example 2: Setting Merge Var arrays when using HTTP GET/POST URL strings. This is just a sample of what your URL string should look like if you wish to pass Merge Vars and/or Interest Groups into the listSubscribe() function. Other functions that accept arrays of parameters should look similar.
#Return format is a JSON object
http://<dc>.api.mailchimp.com/1.3/?method=listSubscribe
&apikey=<apikey - captured from your API dashboard>
&id=<list id - captured from lists()>
&email_address=<email_address>
&merge_vars[FNAME]=Firstname
&merge_vars[LNAME]=Lastname
&merge_vars[INTERESTS]=Dogs,Cats,Shoes
&output=json
Example 3: Setting Merge Var arrays that include the GROUPINGS array when using HTTP GET/POST URL strings. Essentially this is an example to show you how nested/multi-dimensional arrays should be passed in. In this example, the list has two Groupings - "Pets" and "Food" - and we are selecting the "Cat" and "Dog" options for the Pets group and the "Meat" and "Kibble" option for the Food group. Note that the 0 and 1 keys are not used - they simply need to be included to identify they arrays of arrays which are being passed.
#Return format is a JSON object
http://<dc>.api.mailchimp.com/1.3/?method=listSubscribe
&apikey=<apikey - captured from your API dashboard>
&id=<list id - captured from lists()>
&email_address=<email_address>
&merge_vars[FNAME]=Firstname
&merge_vars[LNAME]=Lastname
&merge_vars[GROUPINGS][0][name]=Pets
&merge_vars[GROUPINGS][0][groups]=Cat,Dog
&merge_vars[GROUPINGS][1][name]=Food
&merge_vars[GROUPINGS][1][groups]=Meat,Kibble
&output=json
No idea what the <dc> is? Read about "Submit URLs" in the documentation
Still not clear? Get in touch with us!