I am using RestSharp for creating pages. Page creation work great when the html body stay simple, without any (") double quotes characters.
This exemple work great for me:
request.AddParameter("application/json", "{\"type\": \"page\",\"title\": \"TEST\",\n " + AncestorString + " \"space\": {\"key\": \"" + ConfluenceSpaceKey + "\" }, \"body\": {\"storage\": {\"value\": \"<h2>Hello World</h2> \", \"representation\": \"storage\" } } }", ParameterType.RequestBody);
As soon I as need to add double quotes characters in the html body:
<h2 style =\"color: Tomato;\"> Hello World </h2>
I get this error:
{"statusCode": 500, "message": "", "reason": "Internal Server Error"}
This exemple don't work for me:
request.AddParameter("application/json", "{\"type\": \"page\",\"title\": \"TEST\",\n " + AncestorString + " \"space\": {\"key\": \"" + ConfluenceSpaceKey + "\" }, \"body\": {\"storage\": {\"value\": \"<h2 style =\"color: Tomato;\"> Hello World </h2> \", \"representation\": \"storage\" } } }", ParameterType.RequestBody);
Any ideas?
Thx!!
Hi @Patch
so I assume your escaping is wrong: try something like this:
request.AddParameter("application/json", "{\n \"type\": \"page\",\n \"title\": \"new page22\",\n \"space\": {\n \"key\": \"TS\"\n },\n \"body\": {\n \"storage\": {\n \"value\": \"<p style=\\\"color:red\\\">This is a new page</p>\",\n \"representation\": \"storage\"\n }\n }\n}", ParameterType.RequestBody);
Best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.