Get all values from a label custom field

Hello,

There is any way (restAPI or something like that) to get all the values of a label custom field? I am using JIRA 6.4.12.

Thanks in advance.

Cheers

1 answer

0 vote

REST call to the issue, will return the full issue content in JSON format, inluding labels.

https://site.atlassian.net/rest/api/2/issue/BLAH-123

Component API is via LabelManager.getLabels(long issueId)

Set<Label> getLabels(Long issueId)
Returns all the labels for the given issue.
Parameters:
issueId - The issue id that the label is linked against
Returns:
A set of alphabetically ordered labels for the issue.

 

Hello Andy,

Thanks for your response.

 

This rest end-point will only return the labels used in this specific issue.


What I want, is to get all the options already available in the label custom field.

Thanks in advance.

Cheers,

Jose

> This rest end-point will only return the labels used in this specific issue.

The JIRA APIs are issue centric, there is no API for that.  LabelService can give you _getSuggestedLabels(..)_ with a  nulltoken will give you popular labels.

What I want, is to get all the options already available in the label 

Not possible AFAIK.  With SQL you can do this:

SELECT label FROM "label" where fieldid=10100 group by label order by label

Another path is to use JQL to query for the field, i.e.  LabelsCF  is not empty, then loop over the results (however many) and use the getLabels for each issue, build up a set.

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

127 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you