Accessing and adding options values of projectspecific select field via REST API
I tried to ask this on answers.atlassian.com (https://answers.atlassian.com/questions/263684/accessing-and-modifying-values-of-projectspecific-select-field-via-rest-api) but did not get any reply - I hope this is the right place for this:
Hi all,
the company I am currently work for bought the projectspecific select field plugin https://marketplace.atlassian.com/plugins/jira.plugin.projectspecificselectfield.jpssf (actual version)
We try to import issues from another system and need to fill the fields (of type project specific select). 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
Comments (16)
-
repo owner -
repo owner - marked as enhancement
-
When do you estimate this will be available? Is there any automated way to add a value, even through SQL?
-
repo owner - changed milestone to 2.1.0
- changed title to Accessing and adding options values of projectspecific select field via REST API
-
repo owner - changed status to resolved
For documentation of REST API see Wiki.
-
reporter Great that this is resolved! Thank you!
I just updated the Plugin. When I try to read the existing values I get an HTTP 500: (Jira 6.2.7 running on Tomcat 7 with Sun JDK 7)
{code} 2014-11-03 19:02:21,134 http-bio-8300-exec-8 ERROR XXXXX 1142x507x1 nb1mvx 172.23.236.61 /rest/projectspecificselectfield/1.0/option/get/TEST/customfield_11351 [common.error.jersey.ThrowableExceptionMapper] Server Error in REST: 500: com.sun.jersey.core.spi.factory.ResponseImpl@c03b66a javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.Vector, and Java type class java.util.Vector, and MIME media type application/xml was not found at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) <+1> (ServletContainer.java:537) at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:178) <+1> (ServletContainer.java:795) at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:73) <+16> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) (RestServletUtilsUpdaterFilter.java:26) (RestServletUtilsUpdaterFilter.java:40) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) (ContextFilter.java:25) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.mywork.client.filter.ServingRequestsFilter.doFilter(ServingRequestsFilter.java:37) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.plugins.cors.CorsFilter.doFilter(CorsFilter.java:65) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsDispatcherFilter.doFilter(PrettyUrlsDispatcherFilter.java:60) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter.doFilter(PrettyUrlsSiteMeshFilter.java:92) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsMatcherFilter.doFilter(PrettyUrlsMatcherFilter.java:56) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:36) <+18> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (AccessLogFilter.java:103) (AccessLogFilter.java:87) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (XsrfTokenAdditionRequestFilter.java:54) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+22> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (SecurityFilter.java:234) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (TrustedApplicationsFilter.java:100) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (BaseLoginFilter.java:169) (JiraLoginFilter.java:70) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) (OAuthFilter.java:61) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:40) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+9> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (AbstractJohnsonFilter.java:71) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) <+10> (UrlRewriteFilter.java:394) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (GzipFilter.java:80) (GzipFilter.java:51) (JiraGzipFilter.java:55) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+39> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (AbstractCachingFilter.java:33) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (AbstractEncodingFilter.java:41) (AbstractHttpFilter.java:31) (PathMatchingEncodingFilter.java:45) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (JiraStartupChecklistFilter.java:78) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (MultipartBoundaryCheckFilter.java:41) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (ChainedFilterStepRunner.java:87) (JiraFirstFilter.java:57) (ApplicationFilterChain.java:241) (ApplicationFilterChain.java:208) (StandardWrapperValve.java:220) (StandardContextValve.java:122) (AuthenticatorBase.java:501) (StandardHostValve.java:170) (ErrorReportValve.java:98) (StandardEngineValve.java:116) (CoyoteAdapter.java:408) (AbstractHttp11Processor.java:1040) (AbstractProtocol.java:607) (JIoEndpoint.java:315) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.Vector, and Java type class java.util.Vector, and MIME media type application/xml was not found ... 157 more
Do you know what is wrong here? It seems some jar files or configuration is missing but I do not see any hint about it. Regards Michael
-
repo owner Looks like the vector of options cannot be converted to application/xml response. Can you check to retrieve with application/json?
-
repo owner Anyhow this is a bug and I will release a fix later today or tomorrow.
Thanks for reporting! Holger
-
repo owner - changed status to open
-
repo owner - changed status to resolved
Released version 2.2.0 with a bugfix for application/xml response for getting list of option values via REST API.
Best regards, Holger
-
How do I upgrade from Beta to 2.2 release?
-
repo owner Download 2.2.0 from Marketplace and upload it manually via Plugin Manager similar to installing the beta. Then you are back on track and Plugin Manager in JIRA supports you in future updates again.
-
Is this only for server? anything we can do for cloud? Please help.
-
Hi Holger
Thanks alot for creating this plugin with the much needed REST API support. This REST APIs are very helpful.We are able to pro-grammatically initialize default values to a project specific select field using the REST api mentioned here.
But it allows only one value to be passed in one Rest Api call for adding option values.
In most of the cases a Dropdown/option field will have multiple values, and it will be good to have a provision to send a list of values in the request body for updating the values.
Rest Endpoint: rest/projectspecificselectfield/1.0/customfield/{key}/{Field_ID}
POST Request(Currently working):
{"value":"Barcelona","disabled":false}
Can we pass multiple option values in the request payload for cases where we want to add multiple option values in one Rest Api call? If not, will it be possible to implement and have this useful enhancement as it seems a valid use case.
-
repo owner Hello Vishal! What is the problem with calling the REST endpoint multiple times for multiple values?
-
Problem of partial update when Rest API fail for some reason.
- Log in to comment
If you use the standard JIRA Importer Plugin the option values are created by the importer. You don't need to prepare the option values in advance. I guess you want to use another import mechanism then JIRA Importer Plugin, because you want to implement more like a sync then a one-time import?