Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GET Values from a custom field via JIRA REST API

Tags:

rest

jira

I would like to GET all drop down options for a custom field. For system fields, I use the following URI:

http://localhost:8080/rest/api/2/project/XXXX/components

(for components, versons, etc. Basically system fields), so I tried the following for a custom field

http://localhost:8080/rest/api/2/project/XXXX/customfield_10000

and got a 404 error. I'm not sure what I'm doing wrong as I've been googling for the past 19 hours. The best I search result I got was the following documentation: JIRA Developers Documentation

Please assist, I'm not sure What I'm missing

like image 630
kya Avatar asked Jun 23 '16 07:06

kya


1 Answers

You can get that information either from the createmeta or editmeta REST resources.

Use editmeta if you want to retrieve the available options when editing a specific issue. E.g.

GET /rest/api/2/issue/TEST-123/editmeta

Use createmeta when you want to retrieve the options for a project in combination with an issue type. E.g.

GET /rest/api/2/issue/createmeta?projectKeys=MYPROJ&issuetypeNames=Bug&expand=projects.issuetypes.fields

The customfields with options will be returned like this:

"customfield_12345": {
  "schema": {
    "type": "string",
    "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
    "customId": 12345
  },
  "name": "MySelectList",
  "allowedValues": [
    {
      "self": "http://jira.url/rest/api/2/customFieldOption/14387",
      "value": "Green",
      "id": "14387"
    },
    {
      "self": "http://jira.url/rest/api/2/customFieldOption/14384",
      "value": "Blue",
      "id": "14384"
    }
  ]
}
like image 106
GlennV Avatar answered Sep 28 '22 12:09

GlennV