Search API Connector Documentation
Import Constant Contact Data to Google Sheets
In this guide, we’ll walk through how to pull data from the Constant Contact API directly into Google Sheets, using the API Connector add-on for Google Sheets.
We'll first get an API key from Constant Contact, and then set up a request to pull in email campaign details from your Constant Contact account to your spreadsheet.
Contents
- Before You Begin
- Part 1: Get your Constant Contact API Key
- Part 2: Get your API Request URL
- Part 3: Pull API Data into Sheets
- Part 4: More Example API URLs
- Part 5: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your Constant Contact API Key
- Create a Mashery account at https://constantcontact.mashery.com/member/register. Mashery is the system Constant Contact uses to power their APIs.
- Log in and register a new application at https://constantcontact.mashery.com/apps/register.
You can name it anything, but here we'll name it 'Google Sheets'. You don't need to fill in the other form fields, just leave them blank. - Scroll to the bottom and make sure you've agreed to the terms of service. Click Register Application.
- You will now see your API Key.
- Click the API Tester tab, and then the Get Access Token button.
- This will take you to an account registration/login page. Assuming you already have a Constant Contact account, click I already have an account (otherwise you'll need to click Create Account.
- You'll now be prompted to allow access to the application you just registered ('Google Sheets'). Click Allow.
- You should now see your Access Token. Keep this handy, as we'll need it shortly. Congrats, you're done! You now have access to the Constant Contact API, and can start pulling Constant Contact data into Google Sheets.
Part 2: Get Your API Request URL
- Constant Contact has made this part very easy. Instead of reading through API documentation, we'll just go back to the API Tester tool to get our first API request URL.
Paste in the access token you just got, then click Get and Try it:
- You'll see a request URL appear. Copy this.
- You'll also want the request headers directly below that, so keep those handy too.
Part 3: Pull Constant Contact API Data into Sheets
We’re now ready to enter all our values into API Connector. Here's how to set up the request. Substitute in the request URL and headers you retrieved from the API Tester tool:
- Open up Google Sheets and click Extensions > API Connector > Open > Create request.
- In the request form enter the following:
- Application:
Custom
- Method:
GET
- Request URL:
https://api.constantcontact.com/v2/account/info?api_key=111111
- Headers:
Authorization
:Bearer your_token
X-Originating-IP
:your_ip
- Application:
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see your Constant Contact account data populate your Google Sheet:
Part 4: More Example API URLs
Now that you have the basic connection in place, you can consult the documentation for the full list of API endpoints. Or, if you just want to jump in, try entering the following URLs.
https://api.constantcontact.com/v2/contacts?api_key=YOUR_API_KEY
https://api.constantcontact.com/v2/lists?api_key=YOUR_API_KEY
https://api.constantcontact.com/v2/emailmarketing/campaigns?api_key=YOUR_API_KEY
Part 5: API Documentation
Official API documentation: https://v2.developer.constantcontact.com/docs/developer-guides/api-documentation-index.html
I'm a total novice when it comes to accessing APIs. I have successfully connected ConstantContact API to a Google Sheet per the above instructions and can pull direct data successfully. However, how can I loop through API calls that require a parameter (ie contactid or campaignid)?
Hey Kourtney, you can loop through multiple parameters as described here: https://mixedanalytics.com/knowledge-base/api-connector-run-multiple-queries-single-request/. You can either list out all your URLs in the API URL box, or you can list your contactid or campaignid parameters in a sheet and reference them as described in the "Reference a Range of Cells" section. Let me know if you have any questions!