如何通过rest api向jira问题添加标志

问题描述 投票:3回答:3

我希望能够通过Jira API为问题添加标记。我无法找到有关此问题的任何文档。有谁知道这是如何工作的?

jira jira-rest-api
3个回答
5
投票

我已经想出如何做到这一点,我不确定API的版本。我做了一个POST请求:

你的域名/rest/greenhopper/1.0/xboard/issue/flag/flag.json

并在正文中(用您的问题密钥替换JIRA-ISSUE):

{"issueKeys":["JIRA-ISSUE"],"flag":true}

我希望这有帮助。


2
投票

这是我找到的最佳答案。 https://answers.atlassian.com/questions/38062844/answers/38062897

有一个名为Flagged的字段。它是一个复选框类型字段。默认情况下,有一个值Impediment。检查该字段是否为空状态。如果该字段为空,则不会标记该问题。如果该字段不为null,则标记该问题。

您可以使用REST API。示例在这里 -

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue.

您需要知道字段ID(customfield_10000),或者您需要通过搜索元数据来编写字段的发现 - https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues

在通过API创建问题时设置自定义字段的示例 -

curl -D- -u fred:fred -X POST --data {"fields":{"project":{"key":  "TEST"}, "summary": "Always do right. This will gratify some people and  astonish the REST.", "description": "Creating an issue while setting custom  field values", "issuetype":{"name": "Bug"}, "customfield_10000": [{"value":  "Impediment"}]}} -H "Content-Type: application/json"    http://localhost:8090/rest/api/2/issue/
non-minified data  Expand source
{
"fields": {
   "project":
   { 
      "key": "TEST"
   },
   "summary": "Always do right. This will gratify some people and astonish the REST.",
   "description": "Creating an issue while setting custom field values",
   "issuetype": {
      "name": "Bug"
   },       
   "customfield_10000": [ {"value": "Impediment" }]       
  }
}

1
投票

如上所述here,“已标记”是一个复选框自定义字段,它接受单个值“Impediment”。

您应该能够像使用任何其他自定义字段一样使用JIRA REST API进行设置。也许here的例子会有所帮助。

您还可以使用JIRA Java API设置自定义字段值。

© www.soinside.com 2019 - 2024. All rights reserved.