Got a 'How do I' question? Join 'Ask a Trainer' Monday to Friday, 11am to 4pm ET for instant help and pro tips!

(500) Internal Server Error

SOLVED
Go to solution
ToddB12
Campaign Expert
0 Votes

I have been using Constant Contact API for some time and it has been working fine. All of a sudden I am getting: "The remote server returned an error: (500) Internal Server Error." Nothing in my code has changed. I am using the libraries for .NET, and the error occurs at the 'finally' block in Utility.cs:

 

            Stream stream = Stream.Null;
            try
            {
                // get the response stream
                stream = GetResponseStream(new Uri(currentAddress), authenticationData);

                // parse the stream and get a collection of Contacts
                return ContactComponent.GetContactCollection(stream, out nextChunkId);
            }
            catch (Exception e)
            {
                throw new ConstantException(e.Message, e);
            }
            finally
            {
                // close the response stream
                stream.Close();
            }

 

It seems that this is a problem within Constant Contact as I haven't changed anything with my Authentication Data and am just passing an email address. It occurs when I am trying to use the function Utility.SearchContactByEmail. Any help is appreciated, thanks!

1 ACCEPTED SOLUTION
Nick_G
Employee

Hey Todd,

 

We experienced an issue with our API earlier today, and we restarted the service. It seems to have resolved these issues in all my testing, so let me know if you're still experiencing those same errors. Thanks!

Nick Galbraith
Support Engineer

View solution in original post

26 REPLIES 26
Elijah_G
Marketing Legend
0 Votes

Hello,

 

Regarding issues with Constant Contact for Salesforce, we have assigned the development team responsible for that application to begin working on this error message. I have been testing this issue personally and in my testing so far it appears that the imports are completing successfully, but the application is showing an error message when it should not be. At this time I do not yet know the exact ETA for when this will be resolved, but you should still be able to update your contact lists from Salesforce.

 

If you are having problems with your contacts not importing at all, please let me know!

 

Best Regards,

Elijah G.
API Support Engineer
CateG5
Brand Influencer
0 Votes

Code being used:

	public InputStream doGetRequest(String link) throws ClientProtocolException, IOException {
		logger.log("Request Url: " + link, LogManager.DEBUG);
		HttpGet httpget = new HttpGet(link);
		HttpResponse response = httpclient.execute(httpget);
	
		int status = response.getStatusLine().getStatusCode();
	
		// If receive anything but a 200 status, return a null input stream
		if(status >= 200 && status < 300) {
			logger.log("Successful request", LogManager.DEBUG);
			return response.getEntity().getContent();
		} else {
			logger.log("Unsuccessful request: " + status, LogManager.DEBUG);
			return null;
		}
	}

This is a subset of the series of URLs being hit:

17/29/2014 14:47:38 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/24707/events/bounces
17/29/2014 14:47:39 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/40549/events/bounces
17/29/2014 14:47:40 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/50396/events/bounces
17/29/2014 14:47:41 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/52330/events/bounces
17/29/2014 14:47:42 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/12459/events/bounces
17/29/2014 14:47:43 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/12512/events/bounces
17/29/2014 14:47:44 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/12570/events/bounces
17/29/2014 14:47:45 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/13201/events/bounces

17/29/2014 14:47:46 : Request Url: https://api.constantcontact.com/ws/customers/[Redacted]/contacts/14045/events/bounces

 

Everything is cool until that last URL, which causes a 500 error. Is there anything on our end that needs to change? Anything special about that particular contact that is causing a problem?

 

Best,

Zachary Telschow (AccuVal-LiquiTec)

Elijah_G
Marketing Legend
0 Votes

Hi Zachary,

 

I have taken some time to dig into this, and I found that the reason you are seeing an error from that one contact is because that contact was deleted through the UI. When a contact is deleted in the UI, there is no longer any access to that contact's related events. This should definitely be returning a status other than 500, and I will be looking into what we can do about that.

 

The easiest way to avoid this is to double-check the contact's status by making a request to https://api.constantcontact.com/ws/customers/USERNAME/contacts/CONTACTID first to get the status. If the stataus is REMOVED, then you will not have access to the events for that contact.

 

Please let us know if you are still having any issues!

 

Best Regards,

Elijah G.
API Support Engineer
AndrewG712
Campaign Expert
0 Votes

Elijah:

 

Unfortunately, your response raises more questions than answers...

 

In terms of the contact you mentioned (http://api.constantcontact.com/ws/customers/[username]/contacts/14045),  this contact was deleted via the UI only AFTER we had already received the 500 error while attempting to retrieve contact information. Unfortunately, this issue predates him being deleted.

 

Tangentially, what the process I'm attempting to debug does is:

-get all campaigns from x days ago

-for those campaigns, iterate through them and find any emails that have bounced

-next, take those emails and find out if that contacts email has bounced other times, making them a candidate for removal from our system

 

After we removed 14045, he was still being processed as having been a failed email in a campaign. Is this expected behavior? If so, we're going to need to account for this via the call to retrieve status that you mention. Does contact status appear anywhere in the UI?

 

Lastly, I've run into this issue with another contact. I have not changed it, so it may be more helpful in debugging:

https://api.constantcontact.com/ws/customers/[username]/contacts/17520/events/bounces

 

Thank you so much for your reply and hopefully you can set me straight! Best,

Zachary Telschow (AccuVal LiquiTec)

AndrewG712
Campaign Expert
0 Votes

Hitting https://api.constantcontact.com/ws/customers/[username]/contacts/17520 shows that the user is active, but attempting to retrieve their bounces still returns a 500 error. (This reply should serve as an addendum to my earlier post). Any suggestions?

Shannon_W
Employee
0 Votes

Hi,

 

We did have a data migration that could have affected data associated with your contacts and caused our server not to be able to return the contact through the API. We've been running data cleanup scripts on our side to resolve the issue for all accounts, and I can have you added to the top of the list of accounts to be fixed. I've sent you an email asking for your username to do this.

 

Sorry for the inconvenience!

 

Best Regards,

Shannon Wallace

Partner API Support Engineer

Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up