Wiql - Query By Wiql
Gets the results of the query given its WIQL.
POST https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql?api-version=6.1-preview.2
POST https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql?timePrecision={timePrecision}&$top={$top}&api-version=6.1-preview.2
Name | In | Required | Type | Description |
---|---|---|---|---|
organization
|
path | True |
string |
The name of the Azure DevOps organization. |
project
|
path |
string |
Project ID or project name |
|
team
|
path |
string |
Team ID or team name |
|
api-version
|
query | True |
string |
Version of the API to use. This should be set to '6.1-preview.2' to use this version of the api. |
$top
|
query |
integer (int32) |
The max number of results to return. |
|
time
|
query |
boolean |
Whether or not to use time precision. |
Name | Type | Description |
---|---|---|
query |
string |
The text of the WIQL query |
Name | Type | Description |
---|---|---|
200 OK |
successful operation |
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
Name | Description |
---|---|
vso.work | Grants the ability to read work items, queries, boards, area and iterations paths, and other work item tracking related metadata. Also grants the ability to execute queries, search work items and to receive notifications about work item events via service hooks. |
Sample request
POST https://dev.azure.com/fabrikam/_apis/wit/wiql?api-version=6.1-preview.2
{
"query": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Task' AND [State] <> 'Closed' AND [State] <> 'Removed' order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc"
}
Sample response
{
"queryType": "flat",
"asOf": "2014-12-29T20:49:34.617Z",
"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
}
],
"workItems": [
{
"id": 300,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/300"
},
{
"id": 299,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/299"
},
{
"id": 298,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/298"
},
{
"id": 17,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/17"
},
{
"id": 16,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/16"
},
{
"id": 15,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/15"
},
{
"id": 14,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/14"
},
{
"id": 9,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/9"
},
{
"id": 8,
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/8"
}
]
}
Name | Description |
---|---|
Query |
The result type |
Query |
The type of query. |
Wiql |
A WIQL query |
Work |
Reference to a field in a work item |
Work |
A link between two work items. |
Work |
The result of a work item query. |
Work |
A sort column. |
Work |
Contains reference to a work item. |
The result type
Value | Description |
---|---|
workItem |
A list of work items (for flat queries). |
workItemLink |
A list of work item links (for OneHop and Tree queries). |
The type of query.
Value | Description |
---|---|
flat |
Gets a flat list of work items. |
oneHop |
Gets a list of work items and their direct links. |
tree |
Gets a tree of work items showing their link hierarchy. |
A WIQL query
Name | Type | Description |
---|---|---|
query |
string |
The text of the WIQL query |
Reference to a field in a work item
Name | Type | Description |
---|---|---|
name |
string |
The friendly name of the field. |
referenceName |
string |
The reference name of the field. |
url |
string |
The REST URL of the resource. |
A link between two work items.
Name | Type | Description |
---|---|---|
rel |
string |
The type of link. |
source |
The source work item. |
|
target |
The target work item. |
The result of a work item query.
Name | Type | Description |
---|---|---|
asOf |
string (date-time) |
The date the query was run in the context of. |
columns |
The columns of the query. |
|
queryResultType |
The result type |
|
queryType |
The type of the query |
|
sortColumns |
The sort columns of the query. |
|
workItemRelations |
The work item links returned by the query. |
|
workItems |
The work items returned by the query. |
A sort column.
Name | Type | Description |
---|---|---|
descending |
boolean |
The direction to sort by. |
field |
A work item field. |
Contains reference to a work item.
Name | Type | Description |
---|---|---|
id |
integer (int32) |
Work item ID. |
url |
string |
REST API URL of the resource |