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'
nmrao
6 years agoCommunity Hero
Did it work when you replace with '\\n'?
- pizzaTime6 years agoOccasional Contributor
Nope, and I tried different things
- HimanshuTayal6 years agoCommunity Hero
pizzaTime : Is your problem resolved?