Items - Get
取得單一專案的專案元數據和/或內容。 下載參數是指出內容是否應該以下載的形式提供,或只是以響應中的數據流的形式傳送。 不適用於一律以下載方式傳回的壓縮內容。
GET https://dev.azure.com/{organization}/{project}/_apis/tfvc/items?path={path}&api-version=7.1
GET https://dev.azure.com/{organization}/{project}/_apis/tfvc/items?path={path}&fileName={fileName}&download={download}&scopePath={scopePath}&recursionLevel={recursionLevel}&versionDescriptor.version={versionDescriptor.version}&versionDescriptor.versionOption={versionDescriptor.versionOption}&versionDescriptor.versionType={versionDescriptor.versionType}&includeContent={includeContent}&api-version=7.1
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 組織的名稱。 |
|
project
|
path |
string |
項目識別碼或項目名稱 |
|
|
api-version
|
query | True |
string |
要使用的 API 版本。 這應該設定為 『7.1』 以使用此版本的 API。 |
|
path
|
query | True |
string |
要傳回之個別專案的版本控制路徑。 |
|
download
|
query |
boolean |
如果為 true,請建立可下載的附件。 |
|
|
file
|
query |
string |
傳回之項目的檔名。 |
|
|
include
|
query |
boolean |
設定為 true 以在要求 json 時包含項目內容。 默認值為 false。 |
|
|
recursion
|
query |
無 (只是專案),或 OneLevel (資料夾的內容)。 |
||
|
scope
|
query |
string |
要傳回多個專案之資料夾的版本控制路徑。 |
|
|
version
|
query |
string |
Version 物件。 |
|
|
version
|
query |
版本描述元。 預設值為 null。 |
||
|
version
|
query |
版本描述元。 預設值為 null。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
成功作業 Media Types: "text/plain", "application/octet-stream", "application/zip", "application/json" |
安全性
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.code | 授與讀取有關認可、變更集、分支和其他版本控制成品之原始程式碼和元數據的能力。 也授與搜尋程式代碼的能力,並透過服務攔截取得版本控制事件的通知。 |
範例
GET item metadata and/or content for a single item.
範例要求
GET https://dev.azure.com/{organization}/_apis/tfvc/items?path=$/MyFirstProject/ExampleFolder/TestFile01.txt&api-version=7.1
範例回覆
{
"version": 10,
"changeDate": "2019-05-29T18:00:23.457Z",
"size": 4,
"hashValue": "CY9rzUYh03PK3k6DJie09g==",
"encoding": 65001,
"path": "$/MyFirstProject/ExampleFolder/TestFile01.txt",
"contentMetadata": {
"encoding": 65001,
"contentType": "text/plain",
"fileName": "TestFile01.txt",
"extension": ".txt",
"vsLink": "vsweb://vs/?Product=Visual_Studio&Gen=2013&EncFormat=UTF8&tfslink=dnN0ZnM6Ly8vVmVyc2lvbkNvbnRyb2wvTGF1bmNoTGF0ZXN0VmVyc2lvbmVkSXRlbS8lMjQlMmZNeUZpcnN0UHJvamVjdCUyZkV4YW1wbGVGb2xkZXIlMmZUZXN0RmlsZTAxLnR4dD9wcm9qZWN0PTg3NDQ2MjJkLTdmMGUtNDZlZi04ZjViLWUxNzk2MjNhNGI1YyZ1cmw9aHR0cHMlM0ElMkYlMkZjb2RlZGV2Lm1zJTJGa2V2aW5tY3B6NDIwJTJG"
},
"url": "https://codedev.ms/fabrikam/_apis/tfvc/items/$/MyFirstProject/ExampleFolder/TestFile01.txt?versionType=Latest&versionOptions=None",
"_links": {
"self": {
"href": "https://codedev.ms/fabrikam/_apis/tfvc/items/$/MyFirstProject/ExampleFolder/TestFile01.txt?versionType=Changeset&version=10"
}
}
}
定義
| 名稱 | Description |
|---|---|
|
File |
|
|
Reference |
表示 REST 參考連結集合的類別。 |
|
Tfvc |
專案的元數據。 |
|
Tfvc |
預設值為 None。 |
|
Tfvc |
預設為 Latest。 |
|
Version |
預設為 OneLevel。 |
FileContentMetadata
| 名稱 | 類型 | Description |
|---|---|---|
| contentType |
string |
|
| encoding |
integer (int32) |
|
| extension |
string |
|
| fileName |
string |
|
| isBinary |
boolean |
|
| isImage |
boolean |
|
| vsLink |
string |
ReferenceLinks
表示 REST 參考連結集合的類別。
| 名稱 | 類型 | Description |
|---|---|---|
| links |
object |
連結的只讀檢視。 因為參考連結是只讀的,所以我們只想要將其公開為只讀。 |
TfvcItem
專案的元數據。
| 名稱 | 類型 | Description |
|---|---|---|
| _links |
表示 REST 參考連結集合的類別。 |
|
| changeDate |
string (date-time) |
項目已變更日期時間。 |
| content |
string |
|
| contentMetadata | ||
| deletionId |
integer (int32) |
如果刪除專案,則大於 0。 |
| encoding |
integer (int32) |
來自資料庫的檔案編碼,-1 代表二進位檔。 |
| hashValue |
string |
MD5 哈希作為基底 64 字串,僅適用於檔案。 |
| isBranch |
boolean |
如果專案是分支,則為 True。 |
| isFolder |
boolean |
|
| isPendingChange |
boolean |
如果變更擱置,則為 True。 |
| isSymLink |
boolean |
|
| path |
string |
|
| size |
integer (int64) |
如果適用,檔案的大小。 |
| url |
string |
|
| version |
integer (int32) |
變更集版本標識碼。 |
TfvcVersionOption
預設值為 None。
| 值 | Description |
|---|---|
| none |
沒有。 |
| previous |
傳回舊版。 |
| useRename |
只有與 versiontype MergeSource 和整數版本搭配使用,才能使用 RenameSource 識別符,而不是合併識別符。 |
TfvcVersionType
預設為 Latest。
| 值 | Description |
|---|---|
| change |
版本會被視為變更。 |
| changeset |
版本會被視為 ChangesetId。 |
| date |
版本會被視為日期。 |
| latest |
如果已定義 Version,則會使用該版本的最新版本,如果未定義任何版本,則會使用最新的 ChangesetId。 |
| mergeSource |
版本會被視為 MergeSource。 |
| none |
版本會被視為 ChangesetId。 |
| shelveset |
版本會被視為擱置集名稱和擁有者。 |
| tip |
如果未定義最新版本,版本將會被視為提示。 |
VersionControlRecursionType
預設為 OneLevel。
| 值 | Description |
|---|---|
| full |
傳回指定的專案和所有子系 |
| none |
只傳回指定的專案。 |
| oneLevel |
傳回指定的專案及其直接子系。 |
| oneLevelPlusNestedEmptyFolders |
傳回指定的專案及其直接子系,以及只包含單一資料夾的巢狀子資料夾遞歸鏈結。 |