Jira REST API v3 no longer excepts description as empty string

Board Genius November 24, 2019

Creating an issue via the REST API v3 with description as empty string (like below) used to work until recently:

{'fields': {'project': {'id': xxx}, 'assignee': None, 'description': {'content': [{'content': [{'text': '', 'type': 'text'}], 'type': 'paragraph'}], 'version': 1, 'type': 'doc'}, 'issuetype': {'name': 'Story'}, 'labels': ['test1'], 'summary': 'Ticket'}}

 

Now returns: 400 - "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."

 

Just setting the description allows the request to succeed:

{'fields': {'project': {'id': xxx}, 'assignee': None, 'description': {'content': [{'content': [{'text': 'SOMETHING HERE', 'type': 'text'}], 'type': 'paragraph'}], 'version': 1, 'type': 'doc'}, 'issuetype': {'name': 'Story'}, 'labels': ['test1'], 'summary': 'Ticket'}}

Is there somewhere breaking changes like this are posted and kept track of for us developers that are at the mercy of these changes?

1 answer

0 votes
David_Bakkers
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 28, 2019

Do you still get the error if you don't specify anything for the description, as in:

{'fields': {'project': {'id': xxx}, 'assignee': None, 'type': 'paragraph'}], 'version': 1, 'type': 'doc'}, 'issuetype': {'name': 'Story'}, 'labels': ['test1'], 'summary': 'Ticket'}} 
Board Genius November 30, 2019

No error

David_Bakkers
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.
December 1, 2019

OK, now try setting the description directly, without setting the other values, like content and type etc, as in:

{'fields': {'project': {'id': xxx}, 'assignee': None, 'description': '', 'issuetype': {'name': 'Story'}, 'labels': ['test1'], 'summary': 'Ticket'}}

This is the method I use, but that's for Jira Server, not cloud.

This issue might be related to the use of the description field now being in ADF format, so they might have added a sanity check that, if you define a description in the new format, it must have some content, not nothing.

If that turns out to be the case, you'd have to alter your code to check if the description was empty first, then only add its definition to the request body if it's not nothing.

Suggest an answer

Log in or Sign up to answer