【问题标题】:How to add a flag to jira issue via rest api如何通过rest api向jira问题添加标志
【发布时间】:2016-07-12 11:35:46
【问题描述】:

我希望能够通过 Jira API 向问题添加标志。我找不到有关此问题的任何文档。有谁知道这是怎么回事?

【问题讨论】:

  • 当您说“添加标志”时,您想要做什么。通常,您会通过 UI 向问题添加自定义字段,然后您可以使用 API 设置自定义字段。
  • “标志”是指标签吗?
  • 标记问题是 jira 实现的构造。 confluence.atlassian.com/agile/jira-agile-user-s-guide/… 我真的很希望能够通过 api 做到这一点。

标签: jira jira-rest-api


【解决方案1】:

我已经知道如何做到这一点,但我不确定 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

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

    您将为此使用 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" }]       
      }
    }
    

    【讨论】:

    • 但依赖更新是动机错误Field 'customfield_10000' cannot be set. It is not on the appropriate screen, or unknown... 不是 100%
    【解决方案3】:

    here 所述,“Flagged”是一个复选框自定义字段,接受单个值“Impediment”。

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多