Start a free Courses trial
to watch this video
Learn the general layout and documentation needed to use the MailChimp API.
Resources for specific HTTP Requests
Wrappers from the previous API are still functional with the new MailChimp API
Send us your wrappers! apihelp@mailchimp.com
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upIn the previous video, we talked about a variety of ways you could use 0:00 the MailChimp API to perform a specific task or automate a specific workflow. 0:03 Typically, each of these tasks represent a single resource within MailChimp, and 0:09 have their own URL, called an endpoint. 0:13 For example, if you wanted to get a list of your campaigns, 0:16 you'd use the campaigns endpoint. 0:19 The campaigns end point is located 0:23 at https://us10.api.mailchimp.com/3.0/campa- 0:26 igns where us10 is my specific data center. 0:33 This will vary account by account, but API keys end with a dash, us, and a number. 0:39 The US number is your data center. 0:44 3.0 describes the version of the API we're using and 0:46 campaigns describes the resource we're using. 0:50 For more complex workflows, you may need to interact with multiple API endpoints. 0:52 In our API documentation, we lay out all available HTTP verbs and 0:58 their actions, their individual requirements, and what they should return. 1:02 We also give you some details about specific error messages 1:08 that could be returned if something is missing from the request, 1:11 such as a missing campaign subject line, or if the resource is not available for 1:14 a particular reason, such as the campaign was deleted. 1:18 You can see all of our API documentation at the link included in the teacher's 1:23 notes below. 1:26 With the new version of the API, 1:29 we're also giving each endpoint an associated JSON schema. 1:31 This schema file acts like a road map, 1:35 explaining what data is required on input, and what data can expected on the return. 1:37 Each schema also contains a list of links, 1:42 that will include other related endpoints and aiding with discovery. 1:44 Previous versions of the MailChimp API used individual methods for 1:49 specific tasks. 1:52 For example, to subscribe a new member to a list, 1:53 you'd look at the documentation for the method, list subscribe or list/subscribe. 1:56 With the new version of our API, we're taking a slightly different approach. 2:01 MailChimp's API is based on rest standards. 2:06 Which means that HTTP verbs carry a different set of instructions to 2:09 MailChimp. 2:13 The MailChimp API accepts get, post, patch and delete requests. 2:14 Each of these requests interacts with a resource in a different way. 2:21 For example, if you want to retrieve information from MailChimp, 2:27 such as report data or a list of your subscribers, you can make a get request. 2:30 To create a new resource or item by creating a new campaign or 2:35 adding a new subscriber to your list, you'll make a post request. 2:39 Patch requests are used to update existing items in MailChimp, like modifying your 2:45 list information, or changing an editable section of a campaign. 2:49 With a patch request, we'll only update the information that you send us. 2:53 If you're unfamiliar with how to make a specific type of request, 2:58 there are a number of sites, applications, and resources that can help you, 3:01 such as web sniffer, an online web app, or postman, which is a plug-in for Chrome. 3:05 Those links are included in the teacher's notes below. 3:11 For this course, we'll just be covering the list resource. 3:14 But we've tried to make nearly every aspect of MailChimp's interface 3:18 accessible via the API. 3:21 This includes the often requested ability to create a list within an account 3:23 programmatically. 3:27 For those of you with programming experience we have a variety of wrappers 3:29 available for previous versions of our API. 3:32 Check out the teachers notes included below. 3:34 If you built an API wrapper for 3:37 the new version of our API, drop us a line at the link in teachers notes below. 3:39 We'll happily list your work on that page. 3:43 If you built something else cool with the API we'd love to hear about that too. 3:46
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up