Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to post a formatted Comment(specifically, a table) of html rich to jira using API

sirisha krishna
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 26, 2021

I am getting output as a mix-string of paragraph and table content in a single line text 

Step1: output of api

<p>testing</p><table border="1" style="width:500px"><tbody><tr><td>test</td><td>123</td></tr><tr><td>testing</td><td>456</td></tr></tbody></table><p></p><p>hi jira</p>

Step2: after conversion using html_to_jira_wiki() the output is

"testing\n\ntest123testing456hi jira\n\n"

 

but i need to pass data to jira api should be as below:

testing \n

| test | 123 | \n | testing | 456 | \n

hi jira

Thanks!

1 answer

0 votes
Thomas Deiler
Community Champion
October 27, 2021

Dear @sirisha krishna ,

welcome to the community.

I assume you are using server not cloud, because you didn't specify.

I recommend running first REST call to get an existing comment with a table:

GET /rest/issue/{issueIdOrKey}/comment/{id}

In the answer take the value of "body" and have a look how formatting is done. Then modify and add new comments with

POST /rest/issue/{issueIdOrKey}/comment
{
"body": "replace this with your news comment",
"visibility": {
"type": "role",
"value": "Developers"
}
}

for both calls you can use query parameter expand=renderedBody to process HTML.

So long

Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events