Our v3 API is now available! Learn more by visiting the v3 developer portal. Creating new v2 API keys is no longer supported.

Paginated Output

The Constant Contact API v2 supports paginating the output of a GET call to the API. Some Constant Contact customers have tens of thousands of contacts and hundreds, even thousands, of email campaigns.  We paginate API output so that data can be organized into smaller groups, making it easier to manage, and providing a better user experience.

This article discusses how to use the limit query parameter to paginate output, and the next_link object to retrieve the next page of results.

Using limit and next_link

The optional limit query parameter specifies the number of items displayed per page of output in a response from the API. A default value is used if one is not specified.

This table lists the default and maximum values for each endpoint that supports limit:

Endpoint Default Limit Max Limit
Email Campaigns 50 50
Contact List Membership 50 500
Contacts 50 500
Campaign Tracking 500 500
Contact Tracking 500 500

Example using limit

This GET call to the ContactCollection API sets limit to 25 per page:

GET https//:api.constantcontact.com/v2/contacts?limit=25&api_key=<api_key>

Response: 

{
    "meta": {
        "pagination": {
            "next_link": "/v2/contacts?next=c3RhcnRBdD0yNiZsaW1pdD0yNQ"
        }
    },
    "results": [
        {
            "id": "1",
            "status": "ACTIVE",
            "fax": "",
            "addresses": [
                   {              
                    "id": "fb9394d0-8358-11e2-95c2-00163e24bf8d",
                    "line1": "123 Maple Street",
                    "line2": "3rd Floor",
                    "line3": "Suite 300",
                    "city": "Anytown",
                    "address_type": "PERSONAL",
                    "state_code": "MA",
                    "country_code": "us",
                    "postal_code": "02154",
                    "sub_postal_code": "1781"
                },
                {
                    "line1": "",
                    "line2": "",
                    "line3": "",
                    "city": "",...}

The next_link property in the JSON response provides a link to use in retrieving next page of 25 contacts in the response, shown here:

GET https//:api.constantcontact.com/v2/contacts?api_key=<api_key>&next=<next_link>