Join the Ready, Set, Send Challenge Week 3. Share your QR code or landing page and win a badge!

If an event list is longer than 500, allow sequential API get calls.

user902039
Rookie
0 Votes

Hello, I am James from Chicago. I am facing some problems.

Since the API GET limit is 500, I am unable to get any newly added events (all of which start with the alphabetic letters U-Z). Of course, I have no way of knowing how many events I have actually saved, but the PHP count($events->results) returns 500. (which explains why some events are missing).

Is there a method to run consecutive API GET calls to retrieve the following 500 events (501-1000), as 500 is the upper limit for optimizing back-end data retrieval? If not, can Constant Contact archive the 500 events being obtained from six years ago so that new events are available? By the way, the REST API is the only one where this issue occurs (which I use to create workshop sign-in sheets). The widgets on the Constant Contact website accurately display all the new events.

5 REPLIES 5
user902039
Rookie
0 Votes

Being a webmaster, I appreciate this platform

XinwangN
Rookie
0 Votes
Courtney_E
Moderator
0 Votes

Hello James,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

When making calls to our Legacy V2 API's Events Collection Endpoint, the results returned are paginated, so you should be able to retrieve data for all of the event campaigns within the account by making one or more additional calls:

 

First call (for results 1-500)

 

At the beginning of your response body, you will see a value for "pagination" that contains "next_link" which you can use to call the second page of results:

 

GET 

https://api.constantcontact.com/v2/eventspot/events?limit=500&api_key={API_KEY}

 

Response body:

    "meta": {

        "pagination": {

            "next_link": "/v2/eventspot/events?next={NEXT_PAGE_VALUE}"

        }

    },

    "results": [

        {

            "id": "{EVENT_ID}",

            "name": "{EVENT NAME}",

             [...]

 

Second call (for results 501-1000)

 

Use the "next_link" from the response body of your first call to retrieve the next page of results:

 

GET

https://api.constantcontact.com/v2/eventspot/events?next={NEXT_PAGE_VALUE}&api_key={API_KEY}

 

Additional calls (for results 1001+)

 

If there are more results, a value for "pagination" that contains "next_link" will be present in the response body. If that is the last page of the results, the "next_link" value will not be present.

 

Legacy V2 API - Paginated Output

https://v2.developer.constantcontact.com/docs/developer-guides/paginated-output.html

 

Legacy V2 API - Events Collection Endpoint

https://v2.developer.constantcontact.com/docs/eventspot-apis/events-collection.html?method=GET

 

Please have a look and let us know if you have any other questions!

 


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
JimD884
Rookie
0 Votes

I haven't tried it yet, but anything I can expect to be different with V3? thank you!

Courtney_E
Moderator
0 Votes

Hello JimD884,

 

Thank you for reaching out to Constant Contact API Developer Support. 

 

In V3, pagination works the same way, so while the endpoints and variables may vary slightly between versions, you'd still receive a link in the response body that you'll call to retrieve the next page of results.

 

However, there are currently not any endpoints available in V3 for events. While we're continuously developing and adding endpoints and capabilities to the V3 API, the events tool that we currently offer is considered legacy. Development has begun on a replacement for the event product, but due to its early state we don't have any estimated time of completion available, and it’s unlikely that new event endpoints will be considered for development until sometime after the events tool has been redesigned/deployed.

 

Please have a look and let us know if you have any other questions!


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up