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.

Download all contacts more than 50 at a time using c# library?

SOLVED
Go to solution
Highlighted
Occasional Participant

Download all contacts more than 50 at a time using c# library?

I'm trying to figure out a way to be more efficient in downloading all contacts using the c# library.

 

The only variant of getContacts that allows me to set the limit (# of contacts to get) also seems to an exact email address parameter, which seems to negate the value of the limit parameter.

 

Further, because I will need to repeat the process, I need to use pagination. However, the function that lets me specify pagination does not allow the limit parameter. 

 

What am I missing, or am I stuck with 50 at a time.

 

Thanks for any help!

Marty

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Participant

Re: Download all contacts more than 50 at a time using c# library?

Ok, found the answer: must use the first overload to specify the limit of 500, but with an empty string for the email parameter (documentation does not indicate that this is an optional parameter, but apparently it is).  This returns the first 500 contacts. For subsequent iterations using the 2nd overload for each additional page returns the next 500 contacts. Then repeat until there are no more pages.

 

Thanks for the assist!  Have a great weekend...

Marty 

View solution in original post

6 REPLIES 6
Highlighted
Moderator

Re: Download all contacts more than 50 at a time using c# library?

Hello Marty,

 

Thank you for reaching out to Constant Contact's API Support.

 

Our responses are limited to 50 per page and you do have to use pagination to get the rest of the results. This is by design to assist in maintaining an efficient database on our end. You can reference our documentation for this limit and pagination here. (https://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=GET)


Regards,
Jimmy D.
Tier II API Support Engineer
Highlighted
Occasional Participant

Re: Download all contacts more than 50 at a time using c# library?

Thanks for clarifying - I'll go with that.

 

Just wondering, though, why there's a "limit" parameter in one form of the request, and the API documentation refers to 50 as the default but can go up to 500 with the limit parameter?

Highlighted
Moderator

Re: Download all contacts more than 50 at a time using c# library?

Hello Marty,

 

When our current version of the API was designed that 50 was the default limit chosen; I was not part of the team at that time, but I can ask around to find out if anyone knows the reason for that default limit if you would like. As for the ability to go up to 500; we understand that 50 is not a whole lot to work with and our customers are going to often have larger amounts of contacts. After testing we determined that 500 would give us the best response time while still maintaining optimal efficiency. We also know that there is a need to just pull one contact at a time and so we created the ability to make a call for a single contact as well.


Regards,
Jimmy D.
Tier II API Support Engineer
Highlighted
Occasional Participant

Re: Download all contacts more than 50 at a time using c# library?

I understand the default, and the current value of 50 is just fine.

 

What I'm trying to understand is how to use the GetContacts function in the c# library to request more than 50 (say up to the limit of 500) at a time.

 

There are 2 overloads in the library

 

  • The first overload seems to require an email address, but allows the limit parameter.  Since this one purports to return the exact match to the email address, it's not clear that the limit parameter does anything.
  • The second overload handles the pagination, but doesn't allow specification of a limit parameter.

So, to clarify my question, how should I request 500 records per request, with pagination, so I can connect to the rest of the records?

 

1. 

public ResultSet<Contact> GetContacts(
	string accessToken,
	string apiKey,
	string email,
	Nullable<int> limit,
	Nullable<DateTime> modifiedSince,
	Nullable<ContactStatus> status
)
  

 

2.

public ResultSet<Contact> GetContacts(
	string accessToken,
	string apiKey,
	Nullable<DateTime> modifiedSince,
	Pagination pag
)

 

 

 

Highlighted
Occasional Participant

Re: Download all contacts more than 50 at a time using c# library?

Ok, found the answer: must use the first overload to specify the limit of 500, but with an empty string for the email parameter (documentation does not indicate that this is an optional parameter, but apparently it is).  This returns the first 500 contacts. For subsequent iterations using the 2nd overload for each additional page returns the next 500 contacts. Then repeat until there are no more pages.

 

Thanks for the assist!  Have a great weekend...

Marty 

View solution in original post

Highlighted
Moderator

Re: Download all contacts more than 50 at a time using c# library?

Hi Marty,

 

I apologize for not fully understanding your question. I'm glad you got it figured out. I'll see if we can make our documentation more on point and easier to understand.


Regards,
Jimmy D.
Tier II API Support Engineer
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