Submit request in JIRA API with multiline value

Rajeev Ranjan May 11, 2021

I want my issue description in formatted way so passing multiline value in JIRA API request but it throws error as BAD Request. What is best way to handle this?

{
    "fields": {
       "project": { "key": "TES" },
       "summary": "This is user story",
       "description": "As a 
                       I want   
                       So that  
 Acceptance Criteria: 
 When 
Invoke browser with url
 And
Enter text ABC in field User ID.
 And
Enter password 1234 in field Password 
 And
Click On Submit",
       "issuetype": { "name": "Story" },
       "priority":{ "name":"High" }
   }
} 

 

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2021

Hi @Rajeev Ranjan 

Have you tried to put in new-line \n characters, or other escaped formatting?

Best regards,

Bill

Rajeev Ranjan May 11, 2021

yes and still says Bad request.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2021

Per this article, that should work:

https://confluence.atlassian.com/jirakb/how-to-insert-a-new-line-when-using-lines-the-jira-core-rest-api-779160736.html

Would you please post what you are trying with the newline included?

Like Rajeev Ranjan likes this
Rajeev Ranjan May 12, 2021

I got solution. This packet was coming from different source and description value was having '\n" character but it was throwing Bad request but when I changed that value as "\\n" then it started working. Thanks

Like Bill Sheboy likes this
0 votes
hobweger May 11, 2021

Hi @Rajeev Ranjan , I believe you need to submit the description as an ADF (Atlassian Document Format) object, see https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/.

So for `description`, you'd need to submit something like

Screen Shot 2021-05-11 at 10.38.10 pm.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events