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.

Calling list with updatedsince and listid returns a next link that is always the same

Highlighted
Occasional Participant

Calling list with updatedsince and listid returns a next link that is always the same

Greetings,

 

I'm using the .NET wrapper Version number: 1.0 to syncronize contacts back into my application.

 

Since there was no built in method for fetching contacts on a list updatedsince a certain date, I added one.  The frist call works fine, and I see the next link which is like "?next=2270"

 

When I try to use that link again, it comes back with the exact same results.

 

ie

 

first request:

 

https://api.constantcontact.com/ws/customers/xxx/contacts?updatedsince=2011-12-25T00:00:00Z&listid=1

 

returns 50 contacts with nextlink ?next=22707

 

second request:

 

https://api.constantcontact.com/ws/customers/xxx/contacts?next=22707&updatedsince=2011-12-25T00:00:0...

 

returns 50 contacts with nextlink ?next=22707

 

etc etc...

 

any ideas?  also why are these next links ?next=integer ..when the other endpoints ad next links like "?next=abce3-adfdf"

9 REPLIES 9
Highlighted
Employee

Re: Calling list with updatedsince and listid returns a next link that is always the same

Hey,

 

The next link is different in various collections.  However I was able to navigate to my next 50 on the first next link.  I did notice that there was an error with the next link being completely encoded which isnt done in any of the collections.  I will have our engineering team look into that but the 1st part is not repeating to me. Can you verify that this was your issue?

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Calling list with updatedsince and listid returns a next link that is always the same

REQUEST 1:

 

GET /ws/customers/355adelaide/contacts?updatedsince=2011-12-25T00:00:00Z&listid=1

 

RESPONSE 1: (trimmed just for headers)

 

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://api.constantcontact.com/ws/customers/355adelaide/contacts</id>
  <title type="text">Contacts for Customer: 355adelaide</title>
  <link href="contacts"></link>
  <link href="contacts" rel="self"></link>
  <author>
    <name>355adelaide</name>
  </author>
  <updated>2012-01-04T21:01:32.179Z</updated>
  <link href="/ws/customers/355adelaide/contacts?next=22707&amp;updatedsince=2011-12-29T15%3A12%3A52.985Z&amp;listid=1&amp;ous=2011-12-25T00%3A00%3A00Z" rel="next"></link>
  <link href="/ws/customers/355adelaide/contacts?updatedsince=2011-12-25T00%3A00%3A00Z&amp;listid=1" rel="first"></link>
  <link href="/ws/customers/355adelaide/contacts?updatedsince=2011-12-25T00:00:00Z&amp;listid=1" rel="current"></link>

 

REQUEST 2:  

 

GET /ws/customers/355adelaide/contacts?next=22707&updatedsince=2011-12-25T00:00:00Z&listid=1

 

RESPONSE 2:

 

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://api.constantcontact.com/ws/customers/355adelaide/contacts</id>
  <title type="text">Contacts for Customer: 355adelaide</title>
  <link href="contacts"></link>
  <link href="contacts" rel="self"></link>
  <author>
    <name>355adelaide</name>
  </author>
  <updated>2012-01-04T21:03:34.465Z</updated>
  <link href="/ws/customers/355adelaide/contacts?next=22707&amp;updatedsince=2011-12-29T15%3A12%3A52.985Z&amp;listid=1&amp;ous=2011-12-25T00%3A00%3A00Z" rel="next"></link>
  <link href="/ws/customers/355adelaide/contacts?updatedsince=2011-12-25T00%3A00%3A00Z&amp;listid=1" rel="first"></link>
  <link href="/ws/customers/355adelaide/contacts?next=22707&amp;updatedsince=2011-12-25T00:00:00Z&amp;listid=1" rel="current"></link>
  <entry>
    <link href="/ws/customers/355adelaide/contacts/22654" rel="edit"></link>
    <id>http://api.constantcontact.com/ws/customers/355adelaide/contacts/22654</id>
    <title type="text">Contact: matt.bertulli@gmail.com</title>
    <updated>2011-12-29T15:12:50.934Z</updated>
    <author>
      <name>Constant Contact</name>

notice how next is always the same?

Highlighted
Employee

Re: Calling list with updatedsince and listid returns a next link that is always the same

Hey,

 

Can you use the rest client and save the RCQ file with those results. Once you do that send it to webservices@constantcontact.com and I will try to replicate it in some of our testing accounts.  I have not been able to yet.

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Calling list with updatedsince and listid returns a next link that is always the same

I dont have a mac...

Highlighted
Employee

Re: Calling list with updatedsince and listid returns a next link that is always the same

Hey,

 

You can download a restclient that works with windows here.  There are several versions on that site, command line, GUI and MAC but they are all JAR's.

 

Let me know if that works.

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Calling list with updatedsince and listid returns a next link that is always the same

Email sent awaiting reply thanks.

Highlighted
Employee

Re: Calling list with updatedsince and listid returns a next link that is always the same

Hey,

 

Thank you for sending those files.  The issue appears to be the way the request is being passed back in.  The next link you are passing in is different than that of what it appears in the result.  For example you are doing a get correctly:

 

/ws/customers/{username}/contacts?updatedsince=2011-12-25T00:00:00Z&listid=1

 The next Link in your response is listed as:

 

/ws/customers/{username}/contacts?next=22708&amp;updatedsince=2011-12-29T15%3A12%3A53.007Z&amp;listid=1&amp;ous=2011-12-25T00%3A00%3A00Z

 On your 2nd GET to the next Link you are requesting

/ws/customers/{username}/contacts?next=22708&updatedsince=2011-12-25T00:00:00Z&listid=1

 Where you will need to do a GET to

 

/ws/customers/{username}/contacts?next=22708&updatedsince=2011-12-29T15%3A12%3A53.007Z&listid=1&ous=2011-12-25T00%3A00%3A00Z

Everything is encoded which would need to be decoded before you do the next get.

 

Please let me know if this helps.

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Calling list with updatedsince and listid returns a next link that is always the same

I'm still having issues.

 

In fact, if you look closely to what you wrote to me, you will notice your 'updatedsince' is chanigng on every request.

 

I'm not sure what is causing this, but if I pass in updatedsince as one date....it comes back in the next href with a few days added to it..?!

 

Like I made a request to:

 

https://api.constantcontact.com/ws/customers/355adelaide/contacts?updatedsince=2012-01-01T00%3a00%3a...

 

and got back:

 

/ws/customers/355adelaide/contacts?next=22882&amp;updatedsince=2012-01-05T04%3A44%3A15.504Z&amp;listid=1&amp;ous=2012-01-01T00%3A00%3A00Z

 

 

Notice the upatedsince is changing by adding 4 days??

Highlighted
Moderator

Re: Calling list with updatedsince and listid returns a next link that is always the same

This is actually expected behavior.  The way the pagination works when doing updatedSince is actually based on a time sorted return.  When you run a request like the following:

 

https://api.constantcontact.com/ws/customers/{username}/contacts?updatedsince=2010-07-01T01:00:00.00...

 

With the last updated contact at this time: <LastUpdateTime>2011-11-28T15:04:24.326Z</LastUpdateTime>

 

It will return the 50 oldest updates since the time in question.  The next link is then created with a different time index filter based on the update time of the 51st oldest update and creates the new timestamp.  Using the example above, here is the link that is returned next for me:

 

https://api.constantcontact.com/ws/customers/{username}/contacts?next=58616&updatedsince=2010-12-14T...

 

With the first Contact update time (the 51st overall now) at this time: <LastUpdateTime>2010-12-14T22:07:11.504Z</LastUpdateTime>

 

Notice that the time of the 51st overall pull, which is the first in the next 50 paging, is the same time as the updatedsince filter on the next link.  This is working correctly and is how the API manages the pagination.  Hope this helps clear up the confusion.

Dave Berard
Senior Product Manager, Constant Contact
Tags (1)
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