400 (or 415?) Error posting campaigns.

Hello,

I'm getting two different errors. The application that we run every day is returning a 400: Bad Request error with an empty response body. Strangely, I'm getting a different error when I run the same JSON through Mashery. It returns 415: Unsupported Media Type. The response body of that request is:

I'm pretty sure the problem is due to one certain news entry, but I can't seem to understand why. The application checks for ISO 8859-1 non-compliant characters and weeds them out. After reviewing the JSON I am not finding anything wrong with it.

Indeed, when I found and deleted the white space indicated, I had no problem creating the campaign to my account (changing the list id, and from/reply-to email address). Let me know if you still have issues.

Re: 400 (or 415?) Error posting campaigns.

The first error you are receiving is returned if you have an invalid accept header. If the accept header is provided, it must be application/json. If you provide a different value for Accept, you'd receive a 415 unsupported content type error.

The second error from the validator doesn't look like it's related. I put your JSON posted through a validator and it ran fine. Also, it passes our Schema. Are you sure you are setting the correct Accept header in your calls?

Re: 400 (or 415?) Error posting campaigns.

Looks like there is some sort of confusion here. When I copy/paste your JSON into the same validator, it passes for me. Looks like something must be changing when you post your JSON in the forums editor. Can you save the bad JSON into a file and either link it here or send it to us directly at webservices@constantcontact.com.

Re: 400 (or 415?) Error posting campaigns.

Dave,

There is definitely some confusion going on here, because I just ran the JSON from my previous post through the JSONLint validator and got the same error. See below. At any rate, I have attached a text document containing today's raw JSON (for our newsletter). When I run it through the validator, it says Valid JSON. However, I just ran my code again (POST), and I received an error:

Indeed, when I found and deleted the white space indicated, I had no problem creating the campaign to my account (changing the list id, and from/reply-to email address). Let me know if you still have issues.