我正在使用VSO(Visual Studio Online API),我正在使用此查询:
{
"name": "All Workitems",
"wiql": "Select [System.Id], [System.Title], [System.State] From WorkItems order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc"
}
好吧我期待一个带有ID标题及其状态的工作项列表,但作为回应我只获取其ID和URL。我应该使用什么查询?
响应:
{
"queryType": "flat",
"queryResultType": "workItem",
"asOf": "2015-04-18T05:23:05.353Z",
"columns": [
{
"referenceName": "System.Id",
"name": "ID",
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/fields/System.Id"
},
{
"referenceName": "System.Title",
"name": "Title",
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/fields/System.Title"
},
{
"referenceName": "System.State",
"name": "State",
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/fields/System.State"
}
],
"sortColumns": [
{
"field": {
"referenceName": "Microsoft.VSTS.Common.Priority",
"name": "Priority",
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/fields/Microsoft.VSTS.Common.Priority"
},
"descending": false
},
{
"field": {
"referenceName": "System.CreatedDate",
"name": "Created Date",
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/fields/System.CreatedDate"
},
"descending": true
}
],
"workItems": [
{
"id": 7,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/7"
},
{
"id": 6,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/6"
},
{
"id": 5,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/5"
},
{
"id": 4,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/4"
},
{
"id": 3,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/3"
},
{
"id": 2,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/2"
},
{
"id": 1,
"url": "https://sami1212.visualstudio.com/DefaultCollection/_apis/wit/workItems/1"
}
]
}
答案 0 :(得分:1)
select [system.id] from workitems
然后,当我得到结果时,我从正文中提取了所有ID->字段-> {id,url} [列表]
使用指定的ID列表,我已将ID的列表发送到列表工作项终结点
即/workitems?ids=1,2, ...
,您应该获得包含所有字段的所有工作项的结果。
有趣的是,我们还可以在查询所有工作项时在(ids,ids2 ..)子句中传递where。传递fields
查询参数以过滤字段
答案 1 :(得分:0)
我找到了解决这个问题的方法, 我们可以使用基于ID的WorkItems简单地获取所有webItem的列表,我们将把所有id连接到' id' query param,它将返回所有选定id的列表。例如