The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Extraneous "next" links added to Atom feed when no "pageNumber" specified in API URL

Highlighted
Participant

Extraneous "next" links added to Atom feed when no "pageNumber" specified in API URL

I have discovered that the Event Marketing API (and others?) is adding extraneous "next" links to the Atom feed when no "pageNumber" is specified in the URL and, apparently, there is only one page of results.  A missing "pageNumber" is supposed to be equivalent to specifying "pageNumber=1".  When there is only one page of results, there should be no "next" link.  Unfortunately, that behavior only appears to occur when "pageNumber=1" is added to the initial URL.  Otherwise, an extraneous "next" link specifying "pageNumber=1" is added.



I ran into this issue/bug because my code automatically downloads all pages of results by following each "next" link until no more appear in the feed results.  So, to work around the problem, I am now adding pageNumber=1 to the initial URL.

Paul

3 REPLIES 3
Highlighted
Employee

Re: Extraneous "next" links added to Atom feed when no "pageNumb

I'm sorry, but this is not something that I am experiencing. I must be missing or misunderstanding something, perhaps you could help clarify this for me?


 


When my account contains less than 50 events, a GET to /events returns the following XML, without a 'next' link. Adding the query parameter ?pageNumber=1 did not make a difference


 


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">

    <atom:title>Events</atom:title>

    <atom:updated>2010-12-23T09:33:36.916-05:00</atom:updated>

    <atom:id>tag:api.constantcontact.com,2010:/ws/customers/{username}/events</atom:id>

    <atom:entry>


.....


 


Once I added over 50 events, the XML returned as follows:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">

    <atom:title>Events</atom:title>

    <atom:updated>2010-12-23T09:38:35.069-05:00</atom:updated>

    <atom:id>tag:api.constantcontact.com,2010:/ws/customers/{username}/events</atom:id>

    <atom:link rel="current" href="/ws/customers/{username}/events?pagenumber=1"/>

    <atom:link rel="first" href="/ws/customers/{username}/events"/>

    <atom:link rel="next" href="/ws/customers/{username}/events?pageNumber=2"/>

    <atom:entry>


 


Once I added the query parameter ?pageNumber=2, the next link was no longer present as there was not a next page.

David J

Highlighted
Participant

May only get extraneous link in feed for event registrants

Actually, it looks like the bug may be specific to the registrants feed for an event (i.e. /ws/customers/{username}/events/{event-id}/registrants).  I can easily reproduce that case.  Adding "?pageNumber=1" eliminates the unnecessary link when there is only one page of results.  In my repro case, there is only one registrant, in case that makes a difference.



By the way, thanks for responding so quickly to the issues I have found.

Paul

Highlighted
Employee

Re: May only get extraneous link in feed for event registrants

Hi Paul,


 


I now see the error that you are talking about, and have submitted this to our engineering department to look at as well. Thank you for bringing these to our attention, and I apologize for any inconvenience that they have caused.

David J

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured