Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

How to post multilines via API?



how must the text be formatted, so that I can send multiline text via the API ?

I tried a simple \\n newline symbol, but this is then ignored, also <br>.

e.g. for java I have a simple data object to post to add_case

JSONObject data = new JSONObject();
data.put("steps", "* this do first\\n*This do second"));
data.put("title", "Multiline test");



Hi !

In my python scripts a simple \n works very well, for example :


thanks for that… so somehow the \\n inside the java code is not correct then ?!


sorry i’m not good with java but i found someone who have the same problem as you with the jira rest API in JAVA maybe you can try his solution ?

Hope this can help


again thanks for the investigation… Unfortunately it does not help for TestRail.

When I use \\\\n, I still get

Do it\n* Do that

displayed in TestRail


Have you tried \r\n ?


ah damn… this is another “too stupid to do…”

the solution is simple:

JSONObject data = new JSONObject();
data.put("steps", "* this do first\n*This do second"));
data.put("title", "Multiline test");

who could have though of that…


I thought that you have tried this solution when i posted the screenshot of my python script with \n :smile:

Good job guy !


yeah - there are things I will not talk about… jediwave we forget that