I get this error very often with the openAi API: “ERROR: The data in “Body Parameters” is no valid JSON. Set Body Content Type to “RAW/Custom” for XML or other types of payloads”
Are you in the same case and do you have a solution?
Have a nice day!
I assume in that case something went wrong and the API does not return an error in JSON rather in for example HTML. So nothing n8n could do. The only thing you can do is to activate the automatic retry, in case those are temporary issues.
Yes indeed I have a solution if someone is facing later:
Remove all line breaks in your json. Because n8n will interpret the \n before sending your http request, which will cause an openAi error in the body
Perfect, thanks a lot for sharing the solution!
Ah very sorry, I misread. I thought the problem was that the response was not JSON. In this case, was my answer totally wrong.