We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Invalid Content Error

SOLVED
Go to solution
MarkK8093
Regular Participant

Invalid Content Error

Good morning

I work with a web service with c # api until some time ago it was working fine, now has this problem to create campaigns:

http.status.bad_request: Invalid Content.

The contact list is loaded; but the campaign is never created.

Sending this data:

cc_error.jpg

 

the error is on this line:

 

cc_error2.jpg

 

I hope your answers

Thanks.

 

1 ACCEPTED SOLUTION

Hello,

 

After some additional research, I was able to find a way to resolve the issue for you! While looking into your account, I noticed that one of the custom fields in your account is specifically named "null". This naming of the custom field causes a hiccup with some code related to our Custom Code emails.

 

While we will definitely be looking into how we can correct this issue long-term, the best short-term solution is to simply rename your custom field so that it is something other than "null". For more information on renaming custom fields, you can read this article:

https://knowledgebase.constantcontact.com/articles/KnowledgeBase/5328-add-and-manage-custom-fields

 

If you have further issues after correcting this name, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer

View solution in original post

12 REPLIES 12
Elijah_G
Member

Hello,

 

With the campaign you are trying to create, are you setting the EmailContentFormat as HTML or XHTML? With standard HTML emails this should be functional, but if you are choosing XHTML then there is a <text> XHTML element that is expected in the text version of the campaign.

 

For XHTML the TextContent would want to have the following content:

<text>Testing from web service</text>

One additional piece of information that would help is to get a visual of all of the properties of the EmailCampaign that is being sent. That would help me to identify exactly what is happening.

 

Sincerely,

Elijah G.
API Support Engineer
MarkK8093
Regular Participant

Hi,

Well we are using HTML as the content Format.

But I want to highlight that it was working just fine until a couple of weeks ago. No changes were done on our side and all of a sudden it stopped to work and that is the Error that I received now.

 

So I am sending you the Object’s content with all its Properties, as detailed as possible.

issueCC.jpg

Hello,

 

After looking at this deeper and even re-creating your campaign contents in my own account, I was not able to re-create the issue that you've experienced. After reviewing the code that is used to validate this, it does appear that somehow the actual HTML content that is being sent is causing this 400 invalid content issue.

 

Would it be possible for you to email us at webservices@constantcontact.com with the code that you use to create this campaign object? If I was able to get that snippet of the code that I could implement in the C# SDK, that should give me enough to be able to replicate this issue. Once I can replicate it, I will then be able to quickly identify for you what the cause is for this issue.

 

Please let me know if you have any questions!

 

Sincerely,

Elijah G.
API Support Engineer
MarkK8093
Regular Participant

We are not successful on fixing the issue, so let us go through the steps we did and let us know what you propose please:

  1. our service executes a couple of steps in order to create the campaign: creates the list, adds the contacts to the list, ….. , adds the campaign, schedules the campaign.
  2. All of a sudden, a specific step stopped working: adding the Campaign
  3. The error: bad_request:Invalid Content.
  4. No modifications were done on our end for this to happen
  5. We sent you our code and you said all is OK, our code works fine.

SO

  1. We created a Trial
  2. Use the exact SAME CODE (instead of bulk methods used the simple ones, cause bulks don’t work in trial accounts)
  3. Works OK for the Trial account, no errors no warnings nor nothing the campaign gets created correctly
  4. Keeps on FAILING for our account

How should we proceed?

MarkK8093
Regular Participant

Any update to help please?

Hello,

 

My apologies for the delay! I have been doing a deep dive on this, and while I do have some clues about the cause, I have not yet been able to identify a method that we can use to correct the problems that you are seeing.I will be continuing to research this issue today and I hope to have an update by tomorrow for you.

 

Sincerely,

Elijah G.
API Support Engineer

Hello,

 

After some additional research, I was able to find a way to resolve the issue for you! While looking into your account, I noticed that one of the custom fields in your account is specifically named "null". This naming of the custom field causes a hiccup with some code related to our Custom Code emails.

 

While we will definitely be looking into how we can correct this issue long-term, the best short-term solution is to simply rename your custom field so that it is something other than "null". For more information on renaming custom fields, you can read this article:

https://knowledgebase.constantcontact.com/articles/KnowledgeBase/5328-add-and-manage-custom-fields

 

If you have further issues after correcting this name, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer

View solution in original post

MarkK8093
Regular Participant

 

Thank you very much! that was the issue,
the problem has been solved and all is working just fine.
mamtab6
Occasional Participant

 

I am updating a campaign,after appending uploaded file url into existing email content. but on updating campaign Invalid Content error is coming.

Hello,

 

It seems very likely that the issue you're seeing is because something about the new content you are sending is problematic. The best way for us to help you troubleshoot this issue is to send us an email to webservices@constantcontact.com with the changes that you're trying to make when you update the campaign. We will be able to review this and give you some advice on how you can avoid the invalid content error moving forward.

 

Sincerely,

Elijah G.
API Support Engineer
mamtab6
Occasional Participant

How can i upload pdf file in constant contact using uploadFile method? Using following method image files are uploding successfully  but when i am trying to upload Pdf files, an error "File extension Incorrect "  is comming with status failed. As i know Pdf files needs to be uploaded inside Document library, is there any specific folder Id for adding pdf file inside Document folder?

 

$uploadStatusId=$cc->libraryService->uploadFile(ACCESS_TOKEN,$filenameAttached,$path,"image","MyComputer",$folderId);
                                            

Hello,

 

The folder ID should not matter for what you are trying to accomplish. It is worth noting that the PHP SDK checks the specified file's mime-type to determine the extension and passes that on to the API. I would suggest double-checking the filename and checking the file itself. If you are still getting an error, it would be a great help if you can provide the exact error message.

 

Sincerely,

Elijah G.
API Support Engineer
Developer Portal

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

Visit Page