rahul
rahul

Reputation: 71

Search API based on specific to TITLE(system.title)

https://almsearch.dev.azure.com/${organization}/${project}/_apis/search/workitemsearchresults?api-version=5.1-preview.1

HTTP REQUEST:

Content:  {
  "searchText": "${search}",
  "$skip": 0,
  "$top": 100,
  "filters": {
    "System.WorkItemType": [
      "Issue"
    ],
    "System.State": [
      "Doing",
      "To Do"
    ]
  },
  "$orderBy": [
    {
      "field": "system.id",
      "sortOrder": "ASC"
    }
  ],
  "includeFacets": false
}

this searching the whole board, is there a way to add a filter just to search on title(system.title) itself, i have tried adding the filter system.title it doesnt work

Scenario: if i want to search "ABC" from REST API it is returning the result even if "ABC" exists in description of the story or discussion of the story....so is there a way to search and return the results just based on title and not anything else

Upvotes: 0

Views: 671

Answers (1)

Shamrai Aleksander
Shamrai Aleksander

Reputation: 16133

You can use a work item query with wiql Wiql - Query By Wiql

Wiql example:

SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = 'ProjectName'
  AND  [System.Title] CONTAINS 'Search Text' ORDER BY [System.Id]

Guidance for wiql: Syntax for the Work Item Query Language (WIQL)

Upvotes: 1

Related Questions