Skip to content

Commit

Permalink
Added MailChimp Partner API
Browse files Browse the repository at this point in the history
  • Loading branch information
gomfunkel committed May 11, 2013
1 parent b156576 commit 8f2cc8f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ api.campaignStats({ cid : '/* CAMPAIGN ID */' }, function (error, data) {
console.log(JSON.stringify(data)); // Do something with your data!
});
```

### MailChimp Export API

_MailChimpExportAPI_ takes two arguments. The first argument is your API key, which you can find in your MailChimp Account. The second argument is an options object which can contain the following options:
Expand Down Expand Up @@ -241,6 +241,37 @@ oauth.on('authed', function (apiKey) {

});
```

### MailChimp Partner API

_MailChimpPartnerAPI_ takes two arguments. The first argument is your app key, which you can generate and find in your MailChimp Account, if you are eligible to use the Partner API. The second argument is an options object which can contain the following options:

* `version` The Partner API version to use, currently only 1.3 is available and supported. Defaults to 1.3.
* `secure` Whether or not to use secure connections over HTTPS (true/false). Defaults to false.
* `userAgent` Custom User-Agent description to use in the request header.

The callback function for each API method gets two arguments. The first one is an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.

Example:

```javascript
var MailChimpAPI = require('mailchimp').MailChimpPartnerAPI;

var appKey = 'Your MailChimp app key';

try {
var api = new MailChimpPartnerAPI(appKey, { version : '1.3', secure : false });
} catch (error) {
console.log(error.message);
}

api.checkUsername({ username: '/* USERNAME */' }, function (error, data) {
if (error)
console.log(error.message);
else
console.log(JSON.stringify(data)); // Do something with your data!
});
```

### Mandrill API

Expand Down
1 change: 1 addition & 0 deletions lib/mailchimp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ exports.MailChimpExportAPI = require('./MailChimpExportAPI.js');
exports.MailChimpWebhook = require('./MailChimpWebhook.js');
exports.MailChimpSTSAPI = require('./MailChimpSTSAPI.js');
exports.MailChimpOAuth = require('./MailChimpOAuth.js');
exports.MailChimpPartnerAPI = require('./MailChimpPartnerAPI.js');
exports.MandrillAPI = require('./MandrillAPI.js');

0 comments on commit 8f2cc8f

Please sign in to comment.