输入网址或使用curl运行,例如:
https://<myurl>/rest/api/2/search?jql=project=<myproject>&status=closed&fields=id,key,status,project&maxResults=5
在我的项目中返回5项但具有所有状态。出于某种原因,我无法查询特定状态。
输出(部分)是:
{
"expand": "schema,names",
"startAt": 0,
"maxResults": 5,
"total": 727,
"issues": [
{
"expand": "editmeta,renderedFields,transitions,changelog,operations",
"id": "79577",
"self": "https://<myurl>/rest/api/2/issue/79577",
"key": "<myproject>-774",
"fields": {
"project": {
"self": "https://<myurl>/rest/api/2/project/<myproject>",
"id": "14421",
"key": "<myproject>",
"name": "<myproject>",
"avatarUrls": {
(...)
}
},
"status": {
"self": "<myurl>/rest/api/2/status/1",
"description": "The issue is open and ready for the assignee to start work on it.",
"iconUrl": "https://<myurl>/images/icons/statuses/open.png",
"name": "Open",
"id": "1"
}
}
},(...)
]
}
如何查询给定状态?非常感谢。
答案 0 :(得分:6)
对属性使用网址编码。
也许使用像this这样的在线工具对您的JQL进行URL编码:
project = PROJECTKEY AND status = Closed
得到这个:
/rest/api/2/search?jql=project%20%3D%20PROJECTKEY%20AND%20status%20%3D%20Closed&fields=id,key,status,project&maxResults=5
生成的JSON将是所有已关闭的问题。
答案 1 :(得分:4)
在“问题导航器”中运行所需的查询。使用类似于链接的“共享”按钮左侧的链接来查找查询的URL,例如
http://jira.example.com/issues/?jql=project%20%3D%20MDOAR%20and%20status%20%3D%20Closed
将该网址与curl一起使用