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

Execute a VSTS query and get all its details using API

我在文件夹 shared 下创建了一个 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参数吗?

In the folder of queries, return child queries and folders to this 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] <> ''

这是你想要得到的吗?

编辑

你是nissing团队

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

{团队}