Share via


Queries - Search Queries

Searches all queries the user has access to in the current project

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

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path True

string

Project ID or project name

$filter
query True

string

The text to filter the queries with.

api-version
query True

string

Version of the API to use. This should be set to '7.1' to use this version of the api.

$expand
query

QueryExpand

$includeDeleted
query

boolean

Include deleted queries and folders

$top
query

integer

int32

The number of queries to return (Default is 50 and maximum is 200).

Responses

Name Type Description
200 OK

QueryHierarchyItemsResult

successful operation

Security

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

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.

Definitions

Name Description
IdentityReference

Describes a reference to an identity.

LinkQueryMode

The link query mode.

LogicalOperation

Logical operator separating the condition clause

QueryExpand

The expand parameters for queries. Possible options are { None, Wiql, Clauses, All, Minimal }

QueryHierarchyItem

Represents an item in the work item query hierarchy. This can be either a query or a folder.

QueryHierarchyItemsResult
QueryRecursionOption

The recursion option for use in a tree query.

QueryType

The type of query.

ReferenceLinks

The class to represent a collection of REST reference links.

WorkItemFieldOperation

Describes a work item field operation.

WorkItemFieldReference

Reference to a field in a work item

WorkItemQueryClause

Represents a clause in a work item query. This shows the structure of a work item query.

WorkItemQuerySortColumn

A sort column.

IdentityReference

Describes a reference to an identity.

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias

string

Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary

inactive

boolean

Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary

isAadIdentity

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType)

isContainer

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType)

isDeletedInOrigin

boolean

name

string

Legacy back-compat property. This has been the WIT specific value from Constants. Will be hidden (but exists) on the client unless they are targeting the newest version

profileUrl

string

Deprecated - not in use in most preexisting implementations of ToIdentityRef

uniqueName

string

Deprecated - use Domain+PrincipalName instead

url

string

This url is the full route to the source resource of this graph subject.

LinkQueryMode

The link query mode.

Name Type Description
linksOneHopDoesNotContain

string

Returns work items that satisfy the source, only if no linked work item satisfies the link and target criteria.

linksOneHopMayContain

string

Returns work items that satisfy the source and link criteria, even if no linked work item satisfies the target criteria.

linksOneHopMustContain

string

Returns work items where the source, target, and link criteria are all satisfied.

linksRecursiveDoesNotContain

string

linksRecursiveMayContain

string

Returns work items a hierarchy of work items that by default satisfy the source

linksRecursiveMustContain

string

workItems

string

Returns flat list of work items.

LogicalOperation

Logical operator separating the condition clause

Name Type Description
and

string

none

string

or

string

QueryExpand

The expand parameters for queries. Possible options are { None, Wiql, Clauses, All, Minimal }

Name Type Description
all

string

Expands all properties

clauses

string

Expands Columns, Links, ChangeInfo, WIQL text and clauses

minimal

string

Displays minimal properties and the WIQL text

none

string

Expands Columns, Links and ChangeInfo

wiql

string

Expands Columns, Links, ChangeInfo and WIQL text

QueryHierarchyItem

Represents an item in the work item query hierarchy. This can be either a query or a folder.

Name Type Description
_links

ReferenceLinks

Link references to related REST resources.

children

QueryHierarchyItem[]

The child query items inside a query folder.

clauses

WorkItemQueryClause

The clauses for a flat query.

columns

WorkItemFieldReference[]

The columns of the query.

createdBy

IdentityReference

The identity who created the query item.

createdDate

string

When the query item was created.

filterOptions

LinkQueryMode

The link query mode.

hasChildren

boolean

If this is a query folder, indicates if it contains any children.

id

string

The id of the query item.

isDeleted

boolean

Indicates if this query item is deleted. Setting this to false on a deleted query item will undelete it. Undeleting a query or folder will not bring back the permission changes that were previously applied to it.

isFolder

boolean

Indicates if this is a query folder or a query.

isInvalidSyntax

boolean

Indicates if the WIQL of this query is invalid. This could be due to invalid syntax or a no longer valid area/iteration path.

isPublic

boolean

Indicates if this query item is public or private.

lastExecutedBy

IdentityReference

The identity who last ran the query.

lastExecutedDate

string

When the query was last run.

lastModifiedBy

IdentityReference

The identity who last modified the query item.

lastModifiedDate

string

When the query item was last modified.

linkClauses

WorkItemQueryClause

The link query clause.

name

string

The name of the query item.

path

string

The path of the query item.

queryRecursionOption

QueryRecursionOption

The recursion option for use in a tree query.

queryType

QueryType

The type of query.

sortColumns

WorkItemQuerySortColumn[]

The sort columns of the query.

sourceClauses

WorkItemQueryClause

The source clauses in a tree or one-hop link query.

targetClauses

WorkItemQueryClause

The target clauses in a tree or one-hop link query.

url

string

wiql

string

The WIQL text of the query

QueryHierarchyItemsResult

Name Type Description
count

integer

The count of items.

hasMore

boolean

Indicates if the max return limit was hit but there are still more items

value

QueryHierarchyItem[]

The list of items

QueryRecursionOption

The recursion option for use in a tree query.

Name Type Description
childFirst

string

Returns work items that satisfy the target criteria, even if no work item satisfies the source and link criteria.

parentFirst

string

Returns work items that satisfy the source, even if no linked work item satisfies the target and link criteria.

QueryType

The type of query.

Name Type Description
flat

string

Gets a flat list of work items.

oneHop

string

Gets a list of work items and their direct links.

tree

string

Gets a tree of work items showing their link hierarchy.

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

WorkItemFieldOperation

Describes a work item field operation.

Name Type Description
name

string

Friendly name of the operation.

referenceName

string

Reference name of the operation.

WorkItemFieldReference

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.

WorkItemQueryClause

Represents a clause in a work item query. This shows the structure of a work item query.

Name Type Description
clauses

WorkItemQueryClause[]

Child clauses if the current clause is a logical operator

field

WorkItemFieldReference

Field associated with condition

fieldValue

WorkItemFieldReference

Right side of the condition when a field to field comparison

isFieldValue

boolean

Determines if this is a field to field comparison

logicalOperator

LogicalOperation

Logical operator separating the condition clause

operator

WorkItemFieldOperation

The field operator

value

string

Right side of the condition when a field to value comparison

WorkItemQuerySortColumn

A sort column.

Name Type Description
descending

boolean

The direction to sort by.

field

WorkItemFieldReference

A work item field.