执行 VSTS 查询并使用 API 获取其所有详细信息



我在共享的文件夹下创建了一个 VSTS 查询。但是当我尝试列出我的域下的所有查询时,该文件夹中没有任何内容显示。该文件夹名称显示在该 JSON 响应中。但是该文件夹下的实际查询不会显示。

这是我尝试列出所有查询的方式

https://dev.azure.com/{org}/{projectid}/_apis/wit/queries?api-version=4.1

但它只是列出顶部文件夹。我需要列出该项目下的所有查询

下一个主要问题是,一旦我有一个 API ID 并在执行时它只给我工作项 ID 和 URL。我没有获得任何详细信息,例如其任务或错误或特定信息

这是我尝试的方式

https://dev.azure.com/{org}/{proj}/_apis/wit/wiql/{wiqlid}?api-version=5.0&$expand=all

请帮助我如何解决这两个麻烦。

你能试试depth参数吗?

在查询文件夹中,将子查询和文件夹返回到此深度。

如果你这样做,你会在儿童收藏中得到查询。

https://dev.azure.com/thecodemanual/DevOps Manual/_apis/wit/queries?$expand=all&$depth=2&api-version=5.1

如果您的查询在子文件夹中,这可能会对您有所帮助。

当我运行wiql时,我得到了这个:

https://dev.azure.com/thecodemanual/DevOps Manual/DevOps Manual Team/_apis/wit/wiql/91dad662-7104-4882-b28f-945c152fc4ee?api-version=5.1
{
"queryType": "flat",
"queryResultType": "workItem",
"asOf": "2020-05-15T10:12:01.163Z",
"columns": [
{
"referenceName": "System.Id",
"name": "ID",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.Id"
},
{
"referenceName": "System.WorkItemType",
"name": "Work Item Type",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.WorkItemType"
},
{
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.Title"
},
{
"referenceName": "System.State",
"name": "State",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.State"
},
{
"referenceName": "System.AreaPath",
"name": "Area Path",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.AreaPath"
},
{
"referenceName": "System.IterationPath",
"name": "Iteration Path",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.IterationPath"
},
{
"referenceName": "System.Tags",
"name": "Tags",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.Tags"
}
],
"sortColumns": [
{
"field": {
"referenceName": "System.ChangedDate",
"name": "Changed Date",
"url": "https://dev.azure.com/thecodemanual/_apis/wit/fields/System.ChangedDate"
},
"descending": true
}
],
"workItems": []
}

这是一个在后面运行的 wiql 查询:

select [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags] 
from Workitems 
where [System.TeamProject] = @project and [System.WorkItemType] <> '' and [System.State] <> ''

这是你想要得到的吗?

编辑

你在这里是霏马队

https://dev.azure.com/{org}/{proj}/_apis/wit/wiql/{wiqlid}?api-version=5.0&$expand=all

请在proj后添加team

https://dev.azure.com/{org}/{proj}/{team}/_apis/wit/wiql/{wiqlid}?api-version=5.0&$expand=all

{团队}

最新更新