Forums

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

How to set description such that it is rendered as a codeblock??

Prasang Singhal
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!
July 7, 2020

Hi there, I am trying to create an issue using Jira REST API. I want to set description as a codeblock that should be rendered as below:

Annotation 2020-07-07 180019.png

The above issue is created using UI and description is rendered as it should be.

But I am unable to do the same thing using REST API.

Here is how my description looks like:

{code:title=POST /api/v1/system/alarms/d475-4ccd-aab9-0474bc285a38/acknowledge}
Status code: 409

Payload: null

Response: {
"code": 24,
"codeDesc": "NCERRConflict: Failed due to a conflict with the current state of the target resource"
}

{code}

 This is how my request payload looks like:

payload = {
"fields": {
"summary": summary,
"issuetype": {
"name": issue_type
},
"project": {
"key": project_key
},
"description": {
"type": "codeBlock",
"content": [
{
"type": "text",
"text": description
}
]
}
}
}

But I am getting an error:

{"errorMessages":["We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields. If this situation persists, contact your administrator as they'll be able to access more specific information in the log file."],"errors":{}} 

 Please tell me where I am making the mistake.

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.
July 7, 2020

Hi @Prasang Singhal  -- Welcome to the Atlassian community!

I believe that formatting may not work at this time.  Please see this defect to see if it matches the issue you are seeing: https://jira.atlassian.com/browse/JRACLOUD-72071

Best regards,

Bill

Suggest an answer

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

Atlassian Community Events