How to insert a new line when using lines the JIRA Core REST API

Still need help?

The Atlassian Community is here for you.

Ask the community

The content on this page relates to platforms which are not supported. Consequently, Atlassian Support cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

Purpose

When sending data to the JIRA Core REST API, the new line character must be escaped. This KB instructs in how to do this.

Solution

  1. Insert '\n' into the appropriate field.  For the example below the description field will have a two line description, splitting after the word 'issue' and before 'using':

        "fields": {
           "project":
           {
              "key": "TEST"
           },
           "summary": "REST ye merry gentlemen.",
           "description": "Creating of an issue\nusing project keys and issue type names using the REST API",
           "issuetype": {
              "name": "Bug"
           }
       }
  2. This can be tested with the cURL command as normal:

    curl -D- -u <user>:<pass> -X POST --data @<Example File> -H "Content-Type: application/json" https://<instance>/rest/api/2/issue/
Last modified on Feb 26, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.