Ok, I have been fighting this for several days and thought I might reach out to the community.
I am trying to use an API with this function Create page
The page can be created so that is not an issue. The problem is found when sending the content to the page. I have the content format set to text/md. But when I send it the data it gives a 400 response and shows
Error: 400 Bad Request
{“err”:“Unexpected token \n in JSON at position 202”,“status”:400,“message”:“Unexpected token \n in JSON at position 202”,“timestamp”:“2025-03-19T15:34:44.326Z”,“error”:“Bad Request”,“statusCode”:400}
Having researched this, it seems like the line breaks in the content are causing a problem for the JSON parsing. If I try to use some fancy replaces and make sure to escape the new lines, then I lose the markdown, and the text comes through in one long line with \n in the text instead of parsing as markdown.
Can someone give me a clue as to how to fix this issue?