add text indent when updating comments using rest api

sadhana.chittibabu November 15, 2023

Hi

I am trying to update comment body using JIRA rest API, everything works fine but text indent is not working.

*text* is making the text bold 

\n is creating new line

but I want the next line to start 1 tab space from the previous line

For Ex:

This is my first line

         Here my second line should Start

 

If I use \t that is printing the \t as it is instead of the tab space.

Thanks in advance.

1 answer

0 votes
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.
November 15, 2023

Hi @sadhana.chittibabu 

I do not believe tab is supported in the markdown for the Jira text fields.  You could try entering spaces for your indents, or investigating marketplace addons which can parse that markdown.

Kind regards,
Bill

sadhana.chittibabu November 15, 2023
$msg = $msg."\n*Title*\n    Then next line content with space".
This is the request body to JIRA Update issue API, but still the spaces are not considering.
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.
November 16, 2023

Would you please show the entire body of your request?

I see no spaces or closing quotation mark in what you have posted.

sadhana.chittibabu November 20, 2023

Hi @Bill Sheboy ,

Thanks for your reply, I am adding the post data here for your reference

 

Endpoint

    "/rest/api/2/issue/Key-123",

data:

{
"fields":{
"customfield_xxxx":"Rejected with comments"
},
"update":{
"comment":[
{
"add":{
"body": "Please find the feebacks provided by Requestor in EnVision tool\n*    Register content*\n      testing"
}
}
]
}
}

 

In the above data, \n is printing the comment in the next line as expected but neither '\t' nor "SPACE" is working for the tab space

 Expecting like:

  Please find the feebacks provided by Requestor in EnVision tool

       Register content

             testing

Getting like:

Please find the feebacks provided by Requestor in EnVision tool

Register content

 testing


  

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.
November 20, 2023

It appears to be collapsing / trimming after the newline.

You may want to ping the Atlassian support team, or post this question in the Developer Community: https://community.developer.atlassian.com/

Like sadhana.chittibabu likes this
sadhana.chittibabu November 21, 2023

Thanks for your suggestion.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events