Different behavior of API for fields of type label among custom and standard fields

Himanshu Sharma April 23, 2020

I am facing a weird problem with fields of type label while creating issues like Bug, Epic, Story, etc . 

While creating an issue, When we provide value for standard field labels which contains space, JIRA API handled the case and give proper error like:

{"labels":"The label 'Test lebels' contains spaces which is invalid."}

But when we pass the value in the label type of custom field which contains space like

'Test label', It gives no error and creates two separated labels like `Test`, `Label` .

 

Any comments or suggestions would be highly appreciated. 

1 answer

0 votes
Daniel Ebers
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 12, 2020

Hi Himanshu,

welcome to the Atlassian Community!

It is correct that labels cannot contain a blank space. The blank space for labels works like a separator from UI. Workaround could be a underscore - but this depends on if you like this solutions. Some users don't.

This as being said applies to UI. The REST API might handle it differently. My advise in this case would be not to let labels contain blank spaces. It just won't work or produce not the results someone expects. Maybe you can find interest in the separation of labels.
Alternatively for some use cases the usage of a custom field could make sense.

Cheers,
Daniel

Suggest an answer

Log in or Sign up to answer