Jira rest api在创建问题中插入自定义字段

时间:2017-01-31 08:06:26

标签: json jira jira-rest-api

我有以下自定义字段。如何在JSON中传递它以使用rest api

在jira中创建问题
"customfield_10300":{  
   "required":false,
   "schema":{  
      "type":"option",
      "custom":"com.atlassian.jira.plugin.system.customfieldtypes:select",
      "customId":10300
   },
   "name":"Severity",
   "hasDefaultValue":false,
   "operations":[  
      "set"
   ],
   "allowedValues":[  
      {  
         "self":"http://sjira/rest/api/2/customFieldOption/10303",
         "value":"Blocker",
         "id":"10303"
      },
      {  
         "self":"http://sjira/rest/api/2/customFieldOption/10304",
         "value":"Critical",
         "id":"10304"
      }
   ]
}

1 个答案:

答案 0 :(得分:1)

由于该字段来自类型"选择"您应该使用JSON格式填充选择字段:

这是一个例子:

{
    "fields": {
       "project":
       { 
          "key": "PKEY"
       },
       "summary": "Your summary",
       "description": "your description",
       "issuetype": {
          "name": "Task"
       },       
       "customfield_10013": { "value": "Blocker" }       
   }
}

可以在此处找到更多详细信息:https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue