Accessing and modifying values of projectspecific select field via REST API

Michael Wenig February 17, 2014

Hi all,

the company I am currently work for bought the projectspecific select field plugin https://marketplace.atlassian.com/plugins/jira.plugin.projectspecificselectfield.jpssf

We try to import issues from another system and need to fill the fields. This includes:

* defining the allowed values

* setting the value

I tried to get some information via the REST API browser but got only the field itself and not the allowed values. I got no information on how to define the values.

So my question now is:

* How can I get the allowed values via API for new issues (of a given project)

* How can I define the allowed values (add would be sufficient)

Regards Michael

2 answers

0 votes
Holger Schimanski
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.
March 4, 2014

If you want to use JIRA REST / API to import issues and not the JIRA Importer, then also please use Project Specific Select Field and Project Specific Mulit Select Field custom fields from version 2.0.

They both are standard JIRA select fields with just some extra admin features. They are fully available via JIRAs REST API and meta data of the custom fields can be retrieved e.g. as described here https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Discovering+meta-data+for+creating+issues.

Cheers, Holger

Michael Wenig March 4, 2014

Hi Holger,

thanks for your answers!

Yes we are using 2.0 but the field was the old simple field.

We started with version 2.0 so simple seems to be a good choice (as the "new" field requires to create options on creation we saw this as a field for another usecase) - perhaps a label like "deprecated" or something like that would have prevented this mistake.

I created a new field and indeed now I see the values in the createmeta (which were missing for the old one) - so creation of an issue via Rest seems to work (didn't test it yet).

But I am now confused about the field context. As far as I understand we have to create a context for every single project (which are 100s). This is located in the jira-admin section, so I assume that only system administrators are allowed to do it? Nevertheless we are creating the projects via REST - so the second question still applies:

How can I create a context for a project and how can I define the values (via REST - not UI!) I didn't found anything about that in the Rest-API-Browser (and Java-Rest-Client)

Regards

Michael

Holger Schimanski
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.
March 4, 2014

You need to be JIRA admin (not JIRA sys admin) to create a custom field context. And a re-index is needed then.

If REST API is fine for you, I could think about creating REST API access for JIRA admins to create a custom field context and REST API access for project admins to create option values for that custom field context.

Would this help?

Cheers, Holger

Michael Wenig March 4, 2014

bq. If REST API is fine for you, I could think about creating REST API access for JIRA admins to create a custom field context and REST API access for project admins to create option values for that custom field context.

For creation of the context and importing the existing issues this would be sufficient and also all technical API-access - here we could use a technical user with admin rights for the Rest API access.

The only thing (according to the actual concept) which would be in need via UI for non-jira-admins (but projectadmins) would be to define additional values - would that be possible?

0 votes
Holger Schimanski
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.
March 4, 2014

Are you using Project Specific Select Field version 2.0? I am asking, because with version 2.0 importing data to Project Specific Select Field is now directly supported. You don't need to work arround using APIs.

But please notice that you have to re-create the custom field using the new approach. In version 2.0 two new custom field types Project Specific Select Field and Project Specific Mulit Select Field are added and the previous one renamed to Project Specific Select Field (simple). Please use Project Specific Select Field from version 2.0 and you have direct support for import (and a lot of other improvements compared the the approach from version 1.x).

Does this help?

Cheers, Holger

Suggest an answer

Log in or Sign up to answer