Forum Discussion
pizzaTime
6 years agoOccasional Contributor
Let's say this is the readme I want to update :
## Test description This test verifiy : - lorem text
The error is that what the API expects from a readme is :
## Test description \n This test verifiy :\n - lorem text
So from my groovy script I tried to put it in the request.
{
"id" : "${Properties#pageId}",
"type" : "page",
"status" : "current",
"title" : "Markdown test",
"body" : {
"storage" : {
"value" : "<ac:structured-macro ac:name=\"markdown\" ac:schema-version=\"1\" ac:macro-id=\"1234\"><ac:plain-text-body><![CDATA[${Properties#body}]]></ac:plain-text-body></ac:structured-macro>",
"representation" : "storage",
"_expandable" : {
"content" : "/rest/api/content/${Properties#pageId}"
}
}
},
"version":{"number":${Properties#pageVersion}}
}With :
def carriageReturn= '\\n '
fileContents = fileContents.replaceAll('\n',carriageReturn).replaceAll(' \r',"")Except '\\n' is interpreted as the a carriage return when i want it to be litteraly '\n'
pizzaTime
6 years agoOccasional Contributor
In the request "raw form" :
I see the body on one line, but when I copy-paste it, it is multi-lined.
So my problem is that I want literally the characters "\n" and not it interpreted as 'newline'.
- nmrao6 years agoCommunity HeroHmm..
If you put \n string literals and post the contents, does it work? Do you want to do a quick test for confirmation?