簡體   English   中英

如何使用 REST API 列出 azure 回購中內容的文件

[英]How to list the files with content that are in azure repo using REST API

我指的是這個鏈接。 https://learn.microsoft.com/en-us/rest/api/azure/devops/git/items/get?view=azure-devops-rest-6.0

我需要幫助來為以下情況形成 api 鏈接。

列出特定存儲庫中擴展名為 .yml 的所有文件(及其內容)。

請協助

獲取 Azure Repo 中可用文件列表的唯一方法是調用Rest API 為此,我們必須使用PowerShell

列出所有回購

用於檢索 Repos

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=5.1

# With Optional Parameter
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?includeLinks={includeLinks}&includeAllUrls={includeAllUrls}&includeHidden={includeHidden}&api-version=5.1

獲取文件

它獲取單個項目的內容。 下載參數用於檢查我們是否可以下載內容。

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?path={path}&api-version=5.1

# With Optional Parameter
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?path={path}&scopePath={scopePath}&recursionLevel={recursionLevel}&includeContentMetadata={includeContentMetadata}&latestProcessedChange={latestProcessedChange}&download={download}&$format={$format}&versionDescriptor.versionOptions={versionDescriptor.versionOptions}&versionDescriptor.version={versionDescriptor.version}&versionDescriptor.versionType={versionDescriptor.versionType}&includeContent={includeContent}&resolveLfs={resolveLfs}&api-version=5.1

您可以相應地在您的 PowerShell 中實現上述 Api。 請參閱此處了解如何在 PowerShell 中實現此功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM