-
Notifications
You must be signed in to change notification settings - Fork 4
/
README
70 lines (50 loc) · 2.45 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
NAME
Mail::Chimp::API - Perl wrapper around the Mailchimp API
SYNOPSIS
use strict;
use Mail::Chimp::API;
my $chimp = Mail::Chimp::API->new(apikey => $apikey,
api_version => 1.2);
# or if you have no apikey setup:
# my $chimp = Mail::Chimp::API->new(username => $username,
# password => $password,
# api_version => 1.1,
# );
my $apikey = $chimp->apikey; # generated on first login if none was setup
my $campaigns = $chimp->campaigns;
my $lists = $chimp->lists;
my $subscribers = $chimp->listMembers($lists->[0]->{id});
print 'success' if $chimp->listSubscribe($lists->[0]->{id}, 'someone@somewhere.com', {}, 1);
DESCRIPTION
Mail::Chimp::API is a simple Perl wrapper around the MailChimp API. The
object exposes the MailChimp XML-RPC methods and confesses fault
codes/messages when errors occur. Further, it keeps track of your API
key for you so you do not need to enter it each time.
Method parameters are passed straight through, in order, to MailChimp.
Thus, you do need to understand the MailChimp API as documented at
<http://api.mailchimp.com/> so that you will know the appropriate
parameters to pass to each method.
This API has been tested with version 1.0 and 1.1 of the API.
NOTES
If you find yourself getting '-32602' errors, you are probably missing a
required (even if empty) hash. The API documentation should be your
first destination to verify the validity of your parameters. For
example:
# MailChimp Error -32602: server error. invalid method parameters
print 'fail' if $chimp->listSubscribe($lists->[0]->{id}, 'someone@somewhere.com');
# The {} is required by MailChimp to indicate that you do not want any MergeVars
print 'success' if $chimp->listSubscribe($lists->[0]->{id}, 'someone@somewhere.com', {}, 1);
DEPENDENCIES
Mouse
XMLRPC::Lite
SEE ALSO
XMLRPC::Lite
<http://www.mailchimp.com/api/1.2/>
COPYRIGHT
Copyright (C) 2009 Dave Pirotte. All rights reserved.
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
AUTHOR
Dave Pirotte (dpirotte@gmail.com)
Drew Taylor (drew@drewtaylor.com)
Ask Bjørn Hansen (ask@develooper.com)