I'm at a loss here. I'm trying to do a simple update to an email campaign and I can not get past a 409 error.
Here is my sample code.
Dim emailCampaign = Utility.GetEmailCampaignById(AuthenticationData, "1111762489670")
emailCampaign.Content = HttpContext.Current.Server.HtmlEncode("<html><title></title><body>test</body></html>")
emailCampaign.TextContent = HttpContext.Current.Server.HtmlEncode("<html><title></title><body>test</body></html>")
I'll have someone on our developer support team take a look at this ASAP. My guess is that there is a content issue that is causing a 409 error. While 409 generally means Conflict, we do have some known defects that can result in a 409 being returned due to the values of some of the fields being incorrect. Will update if we find additional information to share with you or need any more information to get into this further.
I'm finding that I get a 409 Conflict error when I PUT a campaign and do NOT change the campain NAME. If I change the name of the campaign, the PUT succeeds. If I don't, I get the 409 error.
I've tested this on my end to make sure I can update a campaign's content (without also changing the name of the campaign). I modified your code a small amount since I wasn't using an html encoding library, and have a different campaign ID. The below code worked to update campaign contents.
Dim basicAuth = New AuthenticationData(apiKey, Username, Password) Dim emailCampaign = Utility.GetEmailCampaignById(basicAuth, "1111718684019") emailCampaign.Content = "<html><title></title><body>test</body></html>" emailCampaign.TextContent = "<html><title></title><body>test</body></html>" ConstantContactUtility.Utility.UpdateEmailCampaign(basicAuth, emailCampaign)
I have seen 409 errors occur when updating information in accounts due to encoding issues with usernames that contain special characters. Do either of your usernames contain special characters, like an @ symbol?
API Support Specialist
I tried to change the campaign name and still get the same error. I changed the content to an encoded string, and that didn't help.
My username is an email so it has an "@" symbol in it. My password also has an "@" symbol in it. Should I take out these special characters out and try it?
Yes, I suspect when your credentials are handled, the @ symbols are getting encoded and not decoded again when making the calls to update properties in your account.
API Support Specialist