Getting Started with the MailChimp API
API Documentation
First and foremost, make sure that you are using the most recent version of the API and associated wrappers.
To serialize or not to serialize, that is the question
Currently you basically have 3 options:
- Use one of our Wrappers or Plugins - that should allow you to not even consider the network transport and encoding. You typically will end up with an object that you can manipulate like you are used to without the worry of how it is connecting
- Find an XML-RPC library for your language of choice and work on implementing it. This approach may require a little more setup time & learning curve, but will likely make your life the easiest in the long run.
- Create HTTP GET/POST URLs and handle one of the Serialized formats that the current version of our API supports. For small jobs, like a simple subscribe, this will work well. The more methods you have to do, the more you will likely kick yourself for choosing this method.
We know mentioning this is like beating a dead horse, but we've also found that 60% - 70% of the support requests we receive are things that folks would have quickly and easily noticed if they were making good use of the errors being returned. Just do it!.
General Notes
If you are not a big coder or are looking to integrate MailChimp service with your current CMS, etc., the first thing to do is check out our Plugins page and see if someone has already released code for your system. If not, keep reading...
Know something that we don't or don't have listed here? Send us a note and we'll probably post it here (or where ever it's appropriate).
PHP 4 & 5 Notes
MCAPI Wrapper - probably the easiest method is to use the MCAPI wrapper class that we provide.
XML-RPC - there are plenty of PHP XML-RPC libraries, classes, etc. out there, however we're going to recommend one : the PEAR XML-RPC2 package. Install it via your system's PEAR facility. And don't let the age of it worry you - it might be a little old and under-maintained, but it works. It's also the package we use internally and test with constantly.
Serialized Formats - This is really just getting into a personal preference of what you'd like to work with.
- Sending Requests: There are 2 standard ways you would do this: a) using PHP's fsockopen() built-in function OR use the PHP CURL library extension. CURL handles a lot of annoying HTTP protocol related things for you, so we'd suggest that.
- Return Formats: Obviously Serialized PHP is the no-brainer for a return format, but PHP also has great support and very usable extensions and libraries for parsing and handling XML or JSON, especially if you are using PHP5 (you should be!).
.Net (ASP, C#, VB, etc) Notes
MC.Net Wrapper - probably the easiest method is to use the MC.Net wrapper class that we provide. It was written as a DLL in C# that you should be able to include in just about any sort of .Net project (DLL source is included). You may also just want to use it as a reference implementation for your own alchemy.
XML-RPC - pretty much the only thing we've seen that's useful in this respect is the CookComputing XML-RPC library. In fact, we used it to build the API Wrapper. The one thing that is going to drive you batty with this is that .Net (and the CLS standard in general) does not support "jagged arrays" (arrays or hashes of arrays or hashes) - see this for a little more info. The MC.Net wrapper code will give you an idea of how we dealt with workarounds for that.
Serialized Formats - While we are not .Net experts by any means, we believe that you'll likely want to look into using XML as it should have the best support.
Ruby / Ruby on Rails Notes
While we have not put a lot of time into testing the different options using Ruby/RoR, some of our users definitely have. Just take a look at
our Plugins page for some RoR gems & plugins to help get you started.
LOLCODE
omgwtfbbq?!1!?! srsly u can haz lolcode phormats. seez hour egsahmples in hour dls sekshun 4 werking code u can d/lBut seriously, just b/c we made it an output format does not mean it's a good idea ;) And don't expect to get much support using it :)
Did we miss something? Have some advice your think we should add here? If so, let us know!