Work Item Search Results - Fetch Work Item Search Results
提供一組搜尋文字的結果。
POST https://almsearch.dev.azure.com/{organization}/{project}/_apis/search/workitemsearchresults?api-version=7.1
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 組織的名稱。 |
|
project
|
path |
string |
項目識別碼或項目名稱 |
|
|
api-version
|
query | True |
string |
要使用的 API 版本。 這應該設定為 『7.1』 以使用此版本的 API。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| $orderBy |
排序搜尋結果的選項。 如果設定為 null,則會依相關性傳回結果。 如果提供多個排序選項,結果會依照 OrderBy 中指定的順序排序。 |
|
| $skip |
integer (int32) |
要略過的結果數目。 |
| $top |
integer (int32) |
要傳回的結果數目。 |
| filters |
object |
要套用的篩選條件。 如果沒有要套用的篩選條件,請將它設定為 null。 |
| includeFacets |
boolean |
旗標以在結果中選擇多面向。 默認行為為 false。 |
| searchText |
string |
搜尋文字。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
成功作業 |
安全性
oauth2
類型:
oauth2
Flow:
accessCode
授權 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
權杖 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
範圍
| 名稱 | Description |
|---|---|
| vso.work | 授與讀取工作項目、查詢、面板、區域和反覆項目路徑,以及其他工作專案追蹤相關元數據的能力。 同時授與執行查詢、搜尋工作專案,以及透過服務攔截接收工作專案事件的通知的能力。 |
範例
範例要求
POST https://almsearch.dev.azure.com/fabrikam/_apis/search/workitemsearchresults?api-version=7.1
{
"searchText": "Rest Api Story",
"$skip": 0,
"$top": 1,
"filters": {
"System.TeamProject": [
"MyFirstProject"
],
"System.AreaPath": [
"MyFirstProject"
],
"System.WorkItemType": [
"Bug",
"User Story",
"Feature",
"Task"
],
"System.State": [
"New",
"Active",
"Closed"
],
"System.AssignedTo": [
"John Doe <[email protected]>"
]
},
"$orderBy": [
{
"field": "system.id",
"sortOrder": "ASC"
}
],
"includeFacets": true
}
範例回覆
{
"count": 2,
"results": [
{
"project": {
"name": "MyFirstProject",
"id": "5a0690b2-823c-4389-a3ab-5ea2a9cbde75"
},
"fields": {
"system.id": "2",
"system.workitemtype": "User Story",
"system.title": "Rest Api User Story",
"system.assignedto": "John Doe <[email protected]>",
"system.state": "Closed",
"system.tags": "api; rest",
"system.rev": "5",
"system.createddate": "2018-01-05T17:14:40.033Z",
"system.changeddate": "2018-01-05T17:55:36.953Z"
},
"hits": [
{
"fieldReferenceName": "system.tags",
"highlights": [
"<highlighthit>api</highlighthit>; <highlighthit>rest</highlighthit>"
]
},
{
"fieldReferenceName": "system.title",
"highlights": [
"<highlighthit>Rest</highlighthit> <highlighthit>Api</highlighthit> User <highlighthit>Story</highlighthit>"
]
}
],
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/2"
}
],
"infoCode": 0,
"facets": {
"System.TeamProject": [
{
"name": "MyFirstProject",
"id": "MyFirstProject",
"resultCount": 2
}
],
"System.WorkItemType": [
{
"name": "Task",
"id": "Task",
"resultCount": 1
},
{
"name": "User Story",
"id": "User Story",
"resultCount": 1
},
{
"name": "Bug",
"id": "Bug",
"resultCount": 0
},
{
"name": "Feature",
"id": "Feature",
"resultCount": 0
}
],
"System.State": [
{
"name": "Closed",
"id": "Closed",
"resultCount": 1
},
{
"name": "New",
"id": "New",
"resultCount": 1
},
{
"name": "Active",
"id": "Active",
"resultCount": 0
}
],
"System.AssignedTo": [
{
"name": "John Doe <[email protected]>",
"id": "John Doe <[email protected]>",
"resultCount": 2
}
]
}
}
定義
| 名稱 | Description |
|---|---|
| Project |
定義專案的詳細數據。 |
|
Sort |
定義如何排序結果。 |
|
Work |
定義工作項目結果欄位中相符的字詞。 |
|
Work |
定義符合工作項目搜尋要求的工作項目結果。 |
|
Work |
定義工作項目搜尋要求。 |
|
Work |
定義針對工作項目搜尋要求傳回的響應專案。 |
Project
定義專案的詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string (uuid) |
項目的標識碼。 |
| name |
string |
項目的名稱。 |
SortOption
定義如何排序結果。
| 名稱 | 類型 | Description |
|---|---|---|
| field |
string |
應該執行排序的功能變數名稱。 |
| sortOrder |
string |
排序結果的順序(ASC/DESC)。 |
WorkItemHit
定義工作項目結果欄位中相符的字詞。
| 名稱 | 類型 | Description |
|---|---|---|
| fieldReferenceName |
string |
醒目提示欄位的參考名稱。 |
| highlights |
string[] |
欄位的相符/反白顯示代碼段。 |
WorkItemResult
定義符合工作項目搜尋要求的工作項目結果。
| 名稱 | 類型 | Description |
|---|---|---|
| fields |
object |
一組標準的工作專案欄位及其值。 |
| hits |
已醒目提示符合搜尋要求的欄位代碼段。 清單會依代碼段的相關性來排序。 |
|
| project |
工作專案的專案詳細數據。 |
|
| url |
string |
工作項目的參考。 |
WorkItemSearchRequest
定義工作項目搜尋要求。
| 名稱 | 類型 | Description |
|---|---|---|
| $orderBy |
排序搜尋結果的選項。 如果設定為 null,則會依相關性傳回結果。 如果提供多個排序選項,結果會依照 OrderBy 中指定的順序排序。 |
|
| $skip |
integer (int32) |
要略過的結果數目。 |
| $top |
integer (int32) |
要傳回的結果數目。 |
| filters |
object |
要套用的篩選條件。 如果沒有要套用的篩選條件,請將它設定為 null。 |
| includeFacets |
boolean |
旗標以在結果中選擇多面向。 默認行為為 false。 |
| searchText |
string |
搜尋文字。 |
WorkItemSearchResponse
定義針對工作項目搜尋要求傳回的響應專案。
| 名稱 | 類型 | Description |
|---|---|---|
| count |
integer (int32) |
相符的工作項目總數。 |
| facets |
object |
字典,針對每個 Facet 儲存 |
| infoCode |
integer (int32) |
數值程式代碼,指出任何其他資訊:0 - 確定,1 - 帳戶正在重新編製索引,2 - 帳戶索引尚未啟動,3 - 不支援前置詞通配符查詢,5 - 不支援程式代碼 Facet 的多字詞,6 - 帳戶正在上線或重新編製索引,8 - 允許的 Maxresult 允許的最大值 9 - 分支正在編製索引, 10 - 未啟用 Faceting、11 - 無法存取的工作專案、19 - 不支援程式代碼類型篩選的片語查詢、20 - 不支援程式代碼類型篩選的通配符查詢。 任何其他資訊程式代碼都用於內部用途。 |
| results |
最上層相符的工作項目清單。 |