Forum Discussion
HimanshuTayal
Community Hero
pizzaTime , could you please attach any screenshot of error for better understanding of problem.:)
pizzaTime
5 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'
- nmrao5 years agoChampion Level 3Did it work when you replace with '\\n'?
- pizzaTime5 years agoOccasional Contributor
Nope, and I tried different things
- HimanshuTayal5 years agoCommunity Hero
pizzaTime : Is your problem resolved?
- pizzaTime5 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'.- nmrao5 years agoChampion Level 3Hmm..
If you put \n string literals and post the contents, does it work? Do you want to do a quick test for confirmation?
Related Content
- 6 months ago
- 3 years ago
Recent Discussions
- 22 days ago