共用方式為


Queries - Get

擷取個別查詢及其子系

GET https://dev.azure.com/{organization}/{project}/_apis/wit/queries/{query}?api-version=5.0
GET https://dev.azure.com/{organization}/{project}/_apis/wit/queries/{query}?$expand={$expand}&$depth={$depth}&$includeDeleted={$includeDeleted}&api-version=5.0

URI 參數

名稱 位於 必要 類型 Description
organization
path True

string

Azure DevOps 組織的名稱。

project
path True

string

專案識別碼或專案名稱

query
path True

string

查詢的識別碼或路徑。

api-version
query True

string

要使用的 API 版本。 這應該設定為 '5.0' 以使用此版本的 API。

$depth
query

integer

int32

在查詢的 資料夾中,將子查詢和資料夾傳回至此深度。

$expand
query

QueryExpand

在結果中包含查詢字串 (wiql) 、子句、查詢結果資料行和排序選項。

$includeDeleted
query

boolean

包含已刪除的查詢和資料夾

回應

名稱 類型 Description
200 OK

QueryHierarchyItem

成功的作業

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名稱 Description
vso.work 授與讀取工作專案、查詢、面板、區域和反復專案路徑,以及其他工作專案追蹤相關中繼資料的能力。 也授與執行查詢、搜尋工作專案,以及透過服務勾點接收工作專案事件通知的能力。

範例

Deleted query by ID
Flat query with expanded clauses
Folder by ID
Folder by Name
Hierarchical query with expanded clauses
Query by ID
Query by Name

Deleted query by ID

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?$includeDeleted=true&api-version=5.0

Sample Response

{
  "id": "342f0f44-4069-46b1-a940-3d0468979ceb",
  "name": "Active Bugs",
  "path": "My Queries/Website/Active Bugs",
  "createdBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "createdDate": "2014-03-18T17:18:36.06Z",
  "lastModifiedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastModifiedDate": "2014-03-18T17:18:36.06Z",
  "lastExecutedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastExecutedDate": "2014-03-18T17:19:36.06Z",
  "isDeleted": true,
  "isPublic": false,
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/342f0f44-4069-46b1-a940-3d0468979ceb"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=342f0f44-4069-46b1-a940-3d0468979ceb"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "wiql": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/wiql/342f0f44-4069-46b1-a940-3d0468979ceb"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/342f0f44-4069-46b1-a940-3d0468979ceb"
}

Flat query with expanded clauses

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?$expand=clauses&api-version=5.0

Sample Response

{
  "id": "df60fdf6-3b5f-4928-aae8-29ee63df6e31",
  "name": "All Bugs",
  "path": "Shared Queries/Website team/All Bugs",
  "queryType": "flat",
  "columns": [
    {
      "referenceName": "System.Id",
      "name": "ID",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.Id"
    },
    {
      "referenceName": "System.Title",
      "name": "Title",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.Title"
    },
    {
      "referenceName": "System.State",
      "name": "State",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.State"
    }
  ],
  "sortColumns": [
    {
      "field": {
        "referenceName": "Microsoft.VSTS.Common.Priority",
        "name": "Priority",
        "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/Microsoft.VSTS.Common.Priority"
      },
      "descending": false
    },
    {
      "field": {
        "referenceName": "System.CreatedDate",
        "name": "Created Date",
        "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.CreatedDate"
      },
      "descending": true
    }
  ],
  "wiql": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Bug' order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc",
  "isPublic": true,
  "clauses": {
    "field": {
      "referenceName": "System.WorkItemType",
      "name": "Work Item Type",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.WorkItemType"
    },
    "operator": {
      "referenceName": "SupportedOperations.Equals",
      "name": "="
    },
    "value": "Bug"
  },
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/df60fdf6-3b5f-4928-aae8-29ee63df6e31"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=df60fdf6-3b5f-4928-aae8-29ee63df6e31"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/addcb8b3-12d0-4f2c-b6ca-52bb584ae286"
    },
    "wiql": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/wiql/df60fdf6-3b5f-4928-aae8-29ee63df6e31"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/df60fdf6-3b5f-4928-aae8-29ee63df6e31"
}

Folder by ID

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?api-version=5.0

Sample Response

{
  "id": "8a8c8212-15ca-41ed-97aa-1d6fbfbcd581",
  "name": "Website team",
  "path": "Shared Queries/Website team",
  "createdBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "createdDate": "2016-06-01T16:58:56.323Z",
  "lastModifiedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastModifiedDate": "2016-06-01T16:58:56.323Z",
  "isFolder": true,
  "hasChildren": true,
  "isPublic": true,
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/eb5c1e25-9b3e-4416-a833-e500122882c7"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
}

Folder by Name

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?api-version=5.0

Sample Response

{
  "id": "8a8c8212-15ca-41ed-97aa-1d6fbfbcd581",
  "name": "Website team",
  "path": "Shared Queries/Website team",
  "createdBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "createdDate": "2016-06-01T16:58:56.323Z",
  "lastModifiedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastModifiedDate": "2016-06-01T16:58:56.323Z",
  "isFolder": true,
  "hasChildren": true,
  "isPublic": true,
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/eb5c1e25-9b3e-4416-a833-e500122882c7"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
}

Hierarchical query with expanded clauses

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?$expand=clauses&api-version=5.0

Sample Response

{
  "id": "f0ade206-32f8-4360-9254-ad33f906cd2e",
  "name": "Active stories with tasks",
  "path": "Shared Queries/Website team/Active stories with tasks",
  "queryType": "tree",
  "columns": [
    {
      "referenceName": "System.Id",
      "name": "ID",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.Id"
    },
    {
      "referenceName": "System.WorkItemType",
      "name": "Work Item Type",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.WorkItemType"
    },
    {
      "referenceName": "System.Title",
      "name": "Title",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.Title"
    },
    {
      "referenceName": "System.AssignedTo",
      "name": "Assigned To",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.AssignedTo"
    },
    {
      "referenceName": "System.State",
      "name": "State",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.State"
    },
    {
      "referenceName": "System.Tags",
      "name": "Tags",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.Tags"
    }
  ],
  "wiql": "SELECT [System.Id],[System.WorkItemType],[System.Title],[System.AssignedTo],[System.State],[System.Tags] FROM WorkItemLinks WHERE ([Source].[System.TeamProject] = @project AND [Source].[System.WorkItemType] = 'Product Backlog Item' AND [Source].[System.State] <> 'Removed') AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') AND ([Target].[System.WorkItemType] = 'Task') mode(Recursive)",
  "isPublic": true,
  "linkClauses": {
    "logicalOperator": "and",
    "clauses": [
      {
        "field": {
          "referenceName": "System.Links.LinkType",
          "name": "Link Type",
          "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.Links.LinkType"
        },
        "operator": {
          "referenceName": "SupportedOperations.Equals",
          "name": "="
        },
        "value": "System.LinkTypes.Hierarchy-Forward"
      }
    ]
  },
  "filterOptions": "linksRecursiveMayContain",
  "sourceClauses": {
    "logicalOperator": "and",
    "clauses": [
      {
        "field": {
          "referenceName": "System.TeamProject",
          "name": "Team Project",
          "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.TeamProject"
        },
        "operator": {
          "referenceName": "SupportedOperations.Equals",
          "name": "="
        },
        "value": "@project"
      },
      {
        "field": {
          "referenceName": "System.WorkItemType",
          "name": "Work Item Type",
          "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.WorkItemType"
        },
        "operator": {
          "referenceName": "SupportedOperations.Equals",
          "name": "="
        },
        "value": "Product Backlog Item"
      },
      {
        "field": {
          "referenceName": "System.State",
          "name": "State",
          "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.State"
        },
        "operator": {
          "referenceName": "SupportedOperations.NotEquals",
          "name": "<>"
        },
        "value": "Removed"
      }
    ]
  },
  "targetClauses": {
    "logicalOperator": "and",
    "clauses": [
      {
        "field": {
          "referenceName": "System.WorkItemType",
          "name": "Work Item Type",
          "url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.WorkItemType"
        },
        "operator": {
          "referenceName": "SupportedOperations.Equals",
          "name": "="
        },
        "value": "Task"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/f0ade206-32f8-4360-9254-ad33f906cd2e"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=f0ade206-32f8-4360-9254-ad33f906cd2e"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/addcb8b3-12d0-4f2c-b6ca-52bb584ae286"
    },
    "wiql": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/wiql/f0ade206-32f8-4360-9254-ad33f906cd2e"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/f0ade206-32f8-4360-9254-ad33f906cd2e"
}

Query by ID

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?api-version=5.0

Sample Response

{
  "id": "342f0f44-4069-46b1-a940-3d0468979ceb",
  "name": "All Bugs",
  "path": "Shared Queries/Website team/All Bugs",
  "createdBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "createdDate": "2014-03-18T17:18:36.06Z",
  "lastModifiedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastModifiedDate": "2014-03-18T17:18:36.06Z",
  "lastExecutedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastExecutedDate": "2014-03-18T17:19:36.06Z",
  "isPublic": true,
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/342f0f44-4069-46b1-a940-3d0468979ceb"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=342f0f44-4069-46b1-a940-3d0468979ceb"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "wiql": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/wiql/342f0f44-4069-46b1-a940-3d0468979ceb"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/342f0f44-4069-46b1-a940-3d0468979ceb"
}

Query by Name

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/queries/{query}?api-version=5.0

Sample Response

{
  "id": "342f0f44-4069-46b1-a940-3d0468979ceb",
  "name": "All Bugs",
  "path": "Shared Queries/Website team/All Bugs",
  "createdBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "createdDate": "2014-03-18T17:18:36.06Z",
  "lastModifiedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastModifiedDate": "2014-03-18T17:18:36.06Z",
  "lastExecutedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "lastExecutedDate": "2014-03-18T17:19:36.06Z",
  "isPublic": true,
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/342f0f44-4069-46b1-a940-3d0468979ceb"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/qr.aspx?pguid=6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c&qid=342f0f44-4069-46b1-a940-3d0468979ceb"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/8a8c8212-15ca-41ed-97aa-1d6fbfbcd581"
    },
    "wiql": {
      "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/wiql/342f0f44-4069-46b1-a940-3d0468979ceb"
    }
  },
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/queries/342f0f44-4069-46b1-a940-3d0468979ceb"
}

定義

名稱 Description
IdentityReference

描述身分識別的參考。

LinkQueryMode

連結查詢模式。

LogicalOperation

分隔線件子句的邏輯運算子

QueryExpand

查詢的展開參數。 可能的選項為 { None, Wiql, Clauses, All, Minimal }

QueryHierarchyItem

表示工作專案查詢階層中的專案。 這可以是查詢或資料夾。

QueryRecursionOption

用於樹狀結構查詢的遞迴選項。

QueryType

查詢的類型。

ReferenceLinks

表示 REST 參考連結集合的類別。

WorkItemFieldOperation

描述工作專案欄位作業。

WorkItemFieldReference

工作專案中欄位的參考

WorkItemQueryClause

表示工作專案查詢中的 子句。 這會顯示工作專案查詢的結構。

WorkItemQuerySortColumn

排序資料行。

IdentityReference

描述身分識別的參考。

名稱 類型 Description
_links

ReferenceLinks

此欄位包含有關圖表主旨的零個或多個有趣連結。 您可以叫用這些連結來取得其他關聯性,或取得此圖表主體的詳細資訊。

descriptor

string

描述項是在系統執行時參考圖形主旨的主要方式。 此欄位可唯一識別帳戶和組織之間的相同圖表主旨。

directoryAlias

string

displayName

string

這是圖表主旨的非唯一顯示名稱。 若要變更此欄位,您必須在來源提供者中變更其值。

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

name

string

舊版 back-compat 屬性。 這是來自常數的 WIT 特定值。 將會隱藏 (,但除非用戶端以最新版本為目標,否則用戶端上存在)

profileUrl

string

uniqueName

string

url

string

此 URL 是此圖表主體來源資源的完整路由。

LinkQueryMode

連結查詢模式。

名稱 類型 Description
linksOneHopDoesNotContain

string

只有在沒有連結的工作專案符合連結和目標準則時,才會傳回滿足來源的工作專案。

linksOneHopMayContain

string

傳回滿足來源和連結準則的工作專案,即使沒有連結的工作專案符合目標準則也一樣。

linksOneHopMustContain

string

傳回滿足來源、目標和連結準則的工作專案。

linksRecursiveDoesNotContain

string

linksRecursiveMayContain

string

傳回工作專案依預設滿足來源的工作專案階層

linksRecursiveMustContain

string

workItems

string

LogicalOperation

分隔線件子句的邏輯運算子

名稱 類型 Description
aND

string

nONE

string

oR

string

QueryExpand

查詢的展開參數。 可能的選項為 { None, Wiql, Clauses, All, Minimal }

名稱 類型 Description
all

string

展開所有屬性

clauses

string

展開資料行、連結、ChangeInfo、WIQL 文字和子句

minimal

string

顯示最小屬性和 WIQL 文字

none

string

展開資料行、連結和 ChangeInfo

wiql

string

展開資料行、連結、ChangeInfo 和 WIQL 文字

QueryHierarchyItem

表示工作專案查詢階層中的專案。 這可以是查詢或資料夾。

名稱 類型 Description
_links

ReferenceLinks

連結相關 REST 資源的參考。

children

QueryHierarchyItem[]

查詢資料夾內的子查詢專案。

clauses

WorkItemQueryClause

一般查詢的 子句。

columns

WorkItemFieldReference[]

查詢的資料行。

createdBy

IdentityReference

建立查詢專案的身分識別。

createdDate

string

建立查詢專案時。

filterOptions

LinkQueryMode

連結查詢模式。

hasChildren

boolean

如果這是查詢資料夾,表示它是否包含任何子系。

id

string

查詢專案的識別碼。

isDeleted

boolean

指出是否刪除此查詢專案。 在已刪除的查詢專案上,將此設定為 false 將會取消刪除。 取消刪除查詢或資料夾並不會傳回先前套用至該查詢或資料夾的許可權變更。

isFolder

boolean

指出這是查詢資料夾或查詢。

isInvalidSyntax

boolean

指出此查詢的 WIQL 是否無效。 這可能是因為語法無效或不再有效的區域/反復專案路徑所造成。

isPublic

boolean

指出此查詢專案是否為公用或私用。

lastExecutedBy

IdentityReference

上次執行查詢的身分識別。

lastExecutedDate

string

上次執行查詢的時間。

lastModifiedBy

IdentityReference

上次修改查詢專案的身分識別。

lastModifiedDate

string

上次修改查詢專案的時間。

linkClauses

WorkItemQueryClause

連結查詢子句。

name

string

查詢專案的名稱。

path

string

查詢專案的路徑。

queryRecursionOption

QueryRecursionOption

用於樹狀結構查詢的遞迴選項。

queryType

QueryType

查詢的類型。

sortColumns

WorkItemQuerySortColumn[]

查詢的排序資料行。

sourceClauses

WorkItemQueryClause

樹狀結構或單一躍點連結查詢中的來源子句。

targetClauses

WorkItemQueryClause

樹狀結構或單一躍點連結查詢中的目標子句。

url

string

wiql

string

查詢的 WIQL 文字

QueryRecursionOption

用於樹狀結構查詢的遞迴選項。

名稱 類型 Description
childFirst

string

傳回符合目標準則的工作專案,即使沒有工作專案符合來源和連結準則也一樣。

parentFirst

string

傳回滿足來源的工作專案,即使沒有任何連結的工作專案符合目標和連結準則也一樣。

QueryType

查詢的類型。

名稱 類型 Description
flat

string

取得工作專案的一般清單。

oneHop

string

取得工作專案及其直接連結的清單。

tree

string

取得顯示其連結階層的工作專案樹狀結構。

表示 REST 參考連結集合的類別。

名稱 類型 Description
links

object

連結的唯讀檢視。 因為參考連結是唯讀的,所以我們只想要將它們公開為唯讀。

WorkItemFieldOperation

描述工作專案欄位作業。

名稱 類型 Description
name

string

作業名稱。

referenceName

string

作業的參考名稱。

WorkItemFieldReference

工作專案中欄位的參考

名稱 類型 Description
name

string

欄位的名稱。

referenceName

string

欄位的參考名稱。

url

string

資源的 REST URL。

WorkItemQueryClause

表示工作專案查詢中的 子句。 這會顯示工作專案查詢的結構。

名稱 類型 Description
clauses

WorkItemQueryClause[]

如果目前子句是邏輯運算子,子子句

field

WorkItemFieldReference

與條件相關聯的欄位

fieldValue

WorkItemFieldReference

欄位與欄位比較時的條件右側

isFieldValue

boolean

判斷這是欄位比較的欄位

logicalOperator

LogicalOperation

分隔線件子句的邏輯運算子

operator

WorkItemFieldOperation

欄位運算子

value

string

當欄位與值比較時,條件的右側

WorkItemQuerySortColumn

排序資料行。

名稱 類型 Description
descending

boolean

排序依據的方向。

field

WorkItemFieldReference

工作專案欄位。