Shannon_W

Frequently Asked Questions

by Moderator on ‎08-29-2012 02:54 PM

If you don't find the answers you are looking for here or by searching our forum (which also searches our documentation), feel free to post a new topic or email webservices@constantcontact.com.

 

General Questions

What are some things I can do to troubleshoot my API requests?

How do I sync my database with Constant Contact? How do I get Notified When Someone (Un)Subscribes?

How can I add contacts to more than one list through the API?

When I add contacts to a new list, they are removed from other lists

I Am Adding a Contact Through The API But They Are Not Receiving the Welcome Email

 

Error Messages

I am Receiving a 400: Bad Request error when attempting to create ***

I am Receiving a 401: Authentication error

I am receiving a 403: Forbidden error when attempting to access *** Collection or Schedule Emails

I am getting a 409 Error

 

Constant Contact Signup Form Generator (CCSFG) Issues

CCSFG is giving me a T_Variable error

My list won’t show up in CCSFG

The CCSFG says the contact already exists and will not add them, but they are not on the list I am t...

 

Authentication

I Am Getting a Redirect URI Mismatch Error When Setting up Authentication

What is Server/Web application flow, and when should it be used?

What is Client flow and when should it be used?

 

 

What are some things I can do to troubleshoot my API requests?

We strongly recommend the use of RESTclient to troubleshoot issues that arise when writing your integration. You can make sure your login credentials are working correctly, and troubleshoot the XML that you are sending to us directly through simple POST PUT GET and DELETE requests. This page explains how to download and use RESTclient.

 

We expect developers to have the troubleshooting knowledge to add breakpoints in their code to identify the source of errors and to echo or capture the values assigned to variables being used in their application at the failure point. Developers should correct issues in their own code, or issues caused by configuration of their development or production environments.

 

How do I sync my database with Constant Contact? How do I get Notified When Someone Subscribes or Unsubscribes?

Unfortunately, we do not provide this as we use a RESTful API. You can query your contacts with the lastupdatedby information each day, and see which contacts were updated yesterday. You can see the status of the contact and check to see if they just subscribed or if they unsubscribed. This information would be returned via XML so you can parse the information right into your database.

 

How can I add contacts to more than one list through the API?

When you do a POST to add/create or PUT to update the contact, you should include ALL lists that you want the contact to be on. Example XML for contact lists is:

If using a wrapper library and working with a contact object, the contactLists are typically added as a list or array to the object, and the method will depend on the library used.

 

When I add contacts to a new list, they are removed from other lists

Doing a PUT or POST for a contact will replace the existing contact information with the new information, including lists. When you do a POST or PUT to add or update the contact, you should include ALL lists that you want the contact to be on. See the above question for example XML for a contact to be added to multiple lists. Your script (code) should have the ability to add contact list nodes to the XML directly or to the contact object (if using an object-oriend API Wrapper).

 

I Am Adding a Contact Through The API But They Are Not Receiving the Welcome Email

If you want your newly added contact to receive the welcome email, their OptInSource should be set to ACTION_BY_CONTACT. If it is set as action by contact but they still don't receive the welcome email, it is possible that the contact you are adding was previously in the account, in which case the system would recognize them and not send out the welcome email. if your integration is making the proper request for pre-existing contacts to update them and add them to a list or additional list/lists, those contacts who had previously unsubscribed will recieve an "Update Profile" email from Constant contact and be added to the list only after using the link in that email and confirming their interests via our webform.

 

I am Receiving a 400: Bad Request error when attempting to create ***

This error is most commonly due to a problem in either the structure or content of your request. Finding the exact cause can require some investigation as there are many variables. Often, the body of the response will provide additional information, such as "errors are found outside the atom namespace" or "email address needs to be supplied." This can often provide a clue. It is best to check whether the URI you are using is correct for the type of request you are making (POST, GET, PUT, or DELETE. Once you've verified that is correct, it is best to check the format of the XML provided to Constant Contact to see if there might be missing, corrupt, or extraneous information. Sometimes simply omitting the xml tag in your xml will solve the problem for the atom namespace error. The RESTclient application is well-suited for troubleshooting 400: Bad Request responses from our API servers, as it allows you to easily edit the uri, header, and body of your request to troubleshoot.

 

I am Receiving a 401: Authentication error

This means that there is a problem with the credentials (username, password, API key, and/or access token) provided to Constant Contact. Depending on the type of authentication you are using, you will want to make sure the places your credentials are being stored have the right information. For basic authentication, you will want to use apiKey%username when providing your username to us. 

 

I am receiving a 403: Forbidden error when attempting to access *** Collection or Schedule Emails

The 403 Forbidden error happens when you try to access a product you may not have or try to access someone else’s information that is not available in your account. This can also come back as a 404. You could be accessing a username in the URI that is not yours. Another common mistake is appending the apikey to the URI. If you are trying to schedule an email but haven't received scheduling permissions, this could be the reason for the 403 error. Simply contact us at webservices@constantcontact.com if other calls are working for you but you can't schedule emails.

 

I am getting a 409 Error

If you are using the Constant Contact Signup Form Generator, the download version on the developer website doesn't update contacts that exist on any list in an account. So, even if they do not exist on the list where you are trying to update contacts, the API will return a 409 error. We prevented the downloadable version of the generator from updating contacts for the reasons explained here, but if you are if you indicate that you understand and are willing to accept those risks, you can request a copy of a version that will allow updates of existing contacts.

 

This error generally means that you are attempting to add a contact that is already in the account (perhaps in the removed or Do Not Mail list).  If the contact already exists in the account, you should be doing a GEt to retrieve their information, updating the XML, and then PUTting the modified XML for them back into your account with a second request.

 

My list won’t show up in CCSFG

CCSFG only shows the first 50 lists by default, however inside of the cc_class.php file you can modify it to change the parameter of the constructor of getLists() by modifying the line of code below from false to true. 

public function getLists($path = '', $getAllLists=FALSE) { 

$getAllLists=FALSE is the default parameter. You can change this to TRUE to let the system push all lists for selection. Be careful, if your account has over 200 lists, CCSFG may not be for you, as apache is not friendly to very long requests. It will timeout often.

 

CCSFG is giving me a T_Variable error

CCSFG is a PHP application that must be uploaded in Binary mode. If it is uploaded in ASCII then the application will fail and you will see this error. Ensure that you uploaded the CCSFG files in binary mode.

 

The CCSFG says the contact already exists and will not add them, but they are not on the list I am trying to add them to (or have been removed or unsubscribed)

The version of the CCSFG we have available on the website does not allow current or previous contacts to be updated or added back into the account for security reasons. If you would like a version of the CCSFG that will allow contacts to be updated, and you understand that existing contact names could be changed (possibly to something negative through your website), or previously unsubscribed people could be added back to your list, email us.

 

 

I Am Getting a Redirect URI Mismatch Error When Setting up Authentication

With OAuth 2, the redirect URI your application passes to our system must match exactly the redirect URI you specify in your API Key settings. For this error, you will want to check 2 things: your code and what your redirect URI is set to for your API Key, as we store this information. To check on your redirect URI settings in Constant Contact, go to the API Key management page, enter your credentials, and click on the hyperlinked API Key to check its settings. The redirect URI is set there.

 

What is Server/Web application flow, and when should it be used?

In the server flow for OAuth 2, the authentication process is carried out by your application scripts on the server, facilitating secure server-side storage of authentication data. It is best when your application is using the Constant Contact API from within your webserver code (for example, from within PHP or Java running on the server).

 

What is Client flow and when should it be used?

The client flow is intended to be handled in a single authorization request, after which the access_token is returned directly to the client web browser or application through code executed on the client, but hosted at a valid url (e.g., hosted Javascript, whose url would then be the redirect uri), where the authentication data can be stored in the client (in a cookie, for example). It makes it simple to obtain an access token when calling the Constant Contact APIs from client langauges such as javascript. This option is best suited for desktop applications, because the authentication data are maintained on the client.