我想通过使用JIRA提供的REST API在JIRA中创建一个问题。 我能够创建一个简单的问题,
使用:
http://localhost:8080/rest/api/latest/issue
和数据如下:
{"fields":{"project":{"key": "TES"},"summary":"user name not showing validation message","description":"Hi validation is missing from user name","issuetype": {"name": "Bug"},"reporter":{"name":"BruceWayne"} }}
运行正常。
现在我想在创建问题时添加3个自定义字段。自定义字段是Authorname, AuthorTag,属于AuthorID。我怎么能在休息api做到这一点。我应该在我的数据中添加什么。
我的样本数据如下: -
{"fields":{"project":{"key": "TES"},"summary":"my bugs 5","description":"Hi","issuetype": {"name": "Bug"},
"customfield_10000":"roach@yahoo.com",
"customfield_10100":{"value":"abc"},
"reporter":{"name":"amit"},
"components": [{
"add" : {"name" : "abc"}
}],"priority": {
"id": "1"
}
}}
我想使用为customfields而不是customfield_XXXXX指定的名称。
我想到的一种方法是在创建一个简单的问题后点击API(使用另一个API命中来获取元数据,如下所示)
http://localhost:8080/rest/api/latest/issue/tes-79?expand=editmeta
然后执行json解析并再次发出put命令来更新同一问题中的字段
但我正在寻找一种方法来实现单一API命中(同时创建问题)
答案 0 :(得分:1)
它应该像设置任何其他字段一样,但你必须使用字段名称" customfield_NNNNN"代替
答案 1 :(得分:0)
我知道现在回答这个问题已经很晚了,但如果不是OP,那么可能会帮助其他人。
如果您对创建有疑问,那么您可以执行以下操作:针对您希望使用新参数手动创建的问题尝试GET
,然后根据然后您可以决定使用新名称或旧式customfield_xxx
字段的新参数更新它。
在GET
cURL
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" https://jira.fred.com/rest/api/2/issue/FRD-88651
然后你可能会像你之前做过的那样做POST
:
http://localhost:8080/rest/api/latest/issue