add a multiline description with curl REST API

I have successfully written ksh code that creates a JIRA ticket using curl and REST API.

I also have script that can create a sub-task for such a main ticket.

My problem is in my sub-task ticket I want to put into the description field detailed error data that is multiple lines. I have successfully used 'tr' to strip returns but that makes the data look horrible as it's just one long line of very difficult to read text.

I would rather have the text show up in the description 'with' multiple lines.

Problem is the ticket creation fails on the first new line as if that's the end of the curl command unless I use 'tr'.

I have tried to use 'tr' to plug in literal '\n' but that's not working either. 'tr' just interprets the slash 'n' and outputs a new line instead of the literal characters. 

I've also tried converting the octals (\015 and \012) to literal "slash n" (\n) using 'sed' but getting the same result as with 'tr' - i.e., the slash in is converted to a physical new line rather than output as literal characters.

Please HELP! 

1 answer

0 vote
Boris Berenberg Community Champion Mar 02, 2015

This is more of a CURL question than a JIRA one. You should be using --data-binary or -d @message.txt I think.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

243 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you