Hi,
I'm working on a project to retrieve labels for a particular JIRA project using it's Rest APIs.
I went through REST documentation, but did not find much.
Hi Som,
I see that you are looking to gather which projects are using specific labels in Jira via REST. If you were using Jira Server and had access to the SQL database, I would actually recommend trying out my steps in this thread https://community.atlassian.com/t5/Jira-questions/Jira-SQL-Query-to-Return-all-Labels-from-the-Label-field-from-a/qaq-p/1085496#M346396
SQL is a preferred method for finding this data because we can specifically select for it.
However if you're using Jira Cloud, you don't have access to the SQL database, so this approach is only helpful for Server versions of Jira. It still might be possible to find this information via REST, but it's going to take a lot of massaging of the data to do this. I'll try to explain why here. First, there is no rest endpoint that can give us all the labels in use. Instead you would need to try to search all the issues in Jira and see what values that they are currently using in the labels field. Not a light task in an of itself, especially in Jira sites with very large numbers of issues.
Once you can see the names of these labels, I fear that you would need to try to run a JQL search via REST for each label name to the endpoint GET /rest/api/2/search a call such as GET /rest/api/2/search?jql='labels in (xyz) order by project desc'
This will at least return all the issues that use a specific label and then order the results by their project. From there you could then take that data to match out the project value per issue or the issue key of the issues returned to see which projects are using this.
But the painful part of this would be the need to re-run the search for each label type and repeat these steps over and over until you have found all the labels. It's not a pretty solution. I would much prefer the ability to use SQL to solve this specific request personally, but I don't know if there is a specific reason why you want to use REST to do this, perhaps for the sake of an integration or plugin for Jira that you want to use to then do something with that data. In which case, the data manipulation technique I have suggested above might be more work than you are looking for to try to find this information in a Jira cloud site.
Sorry this probably is not the answer you were hoping for, but I hope it helps.
Andy
Hey Andy,
I just discovered that Jira have autocomplete url for labels, which can be used to get the response based on search text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Som,
Did that help you here? I'd be interested to learn anything more you can detail here about your findings. I realize in the Jira application you can use the autocomplete to see existing labels, but it doesn't quite help to figure out which ones are in use on a per project basis.
There is also a REST API endpoint for GET /rest/api/3/label. But again, this just gives you back the labels in use across all projects.
Regards,
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andy, I tried GET /rest/api/3/label but it returned "found a dead link. - JIRA". Could you help on GET https://domain.com/rest/api/3/label
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.