通过JIRA REST API从自定义字段获取值 [英] GET Values from a custom field via JIRA REST API

查看:761
本文介绍了通过JIRA REST API从自定义字段获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取自定义字段的所有下拉选项.对于系统字段,我使用以下URI:

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/组件

(用于组件,versons等,基本上是系统字段),因此我尝试将以下内容用于自定义字段

(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

,并显示404错误.我不确定在过去的19个小时里一直在搜索谷歌,这是我做错了什么.我得到的最好的搜索结果是以下文档: JIRA开发人员文档

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

推荐答案

您可以从

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

如果要在编辑特定问题时检索可用选项,请使用editmeta.例如.

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

当您要结合问题类型检索项目的选项时,请使用createmeta.例如

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

带有选项的customfields将返回如下:

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"
    }
  ]
}

这篇关于通过JIRA REST API从自定义字段获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆