New API Key

Highlighted
Occasional Participant

New API Key

I just registered a new API key for a different CC account different from the one I had been using. Using the exact same code (aside from username/password and api key), I get a 400 - Bad request from CC when trying to add a new contact via a web form.

 

I can even use the code (in question) that is not working, with the username/pass/key fom the other account and it works fine.

 

Is there some kind of wait period or activation I am missing?

6 REPLIES 6
Highlighted
Moderator

Re: New API Key

If you're changing accounts, the 400 error likely is something about the data you're sending that is account specific such as List ID.  Have you looked at the error message we are sending back to you to see what it is that is wrong with the data?  Typically we send back a very detailed and specific error message in the response body of the 400 error that tells you exactly what is wrong with the data.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Re: New API Key

It seems like the lists are the right direction, but I get my error trying to get a response from CC server, so dot net returns the code, but no information.

 

This is the string as I am sending to CC - MYACCOUNT is depersonalized

 

activityType=SV_ADD&data=Email+Address%2cFirst+Name%2cLast+Name%0am1%40zmark.net%2cMark%2cZTesting1&lists=http%3a%2f%2fapi.constantcontact.com%2fws%2fcustomers%2fMYACCOUNT%2flists%2fBook+List

Highlighted
Occasional Participant

Re: New API Key

OK, it appears list is a number. How do I find the list numbering?

Highlighted
Occasional Participant

Re: New API Key

I have found many posts that are no longer valid as per finding a list Id. Why should this be so convulated, ever changing when it is so widely used? After all, it's just a numeric Id..

 

Any more clear examples/KB articles etc to get this?

Highlighted
Moderator

Re: New API Key

Sorry for the frustrations you're having.  We have not changed how list IDs are retrieved through the API in nearly 5 years. However, there were some unintended ways to find the list ID in our UI by poking around under the covers of our website application.  Those are always changing as we change our product and were not intended to be used by integrations leveraging our API. 

 

We provide API endpoints in both our v1 and v2 API for pulling lists.  For the v2 API, you can find the documentation here: http://developer.constantcontact.com/docs/contact-list-api/contactlist-collection.html

 

For the v1 API, you can find the documentation here: https://community.constantcontact.com/t5/Documentation/Retrieving-a-Contact-List-Collection/ba-p/250...

 

Both of those API calls will provide you with all of the lists in your account and the IDs of those lists.  Hope this helps!

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Re: New API Key

I found that and got help via the mashery site but unfortunately spent too much time before I got your response.

 

It appears the new ListIds (from newly generated Lists) are long int where as the previous ListId where a small num starting at 1.  Adding a contact to  using a new style ListIds added the contact to that listId and to some old style listids - almost at random. Very strange! I had to remove the old lists and move contacts over t keep things straight.

 

Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured