Java 使用Azure devops git rest api从分支获取文件列表

Java 使用Azure devops git rest api从分支获取文件列表,java,azure-devops-rest-api,Java,Azure Devops Rest Api,使用Azure Devops rest api从分支获取文件列表需要精确的rest api 使用Azure devops git rest api从分支获取文件列表 您可以将REST API与查询字符串参数versionDescriptor.version和recursionLevel一起使用,记录为版本字符串标识符(标记的名称/分支,提交的SHA1) 因此,我们可以使用以下URL: GET https://dev.azure.com/{organization}/{project}/_apis

使用Azure Devops rest api从分支获取文件列表需要精确的rest api

使用Azure devops git rest api从分支获取文件列表

您可以将REST API与查询字符串参数
versionDescriptor.version
recursionLevel
一起使用,记录为版本字符串标识符(标记的名称/分支,提交的SHA1)

因此,我们可以使用以下URL:

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?recursionLevel=Full&versionDescriptor.version=<YourBranchName>&api-version=5.0
测试结果:


你试过什么?你做了什么研究?什么不适用于您的实现?我没有使用azure devops rest api从分支获取所有文件列表的确切rest api端点。如果你能帮忙,那对我会有帮助的。非常感谢。它按要求工作。
$connectionToken="Your PAT"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))

$Itemlisturl = "https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?recursionLevel=Full&versionDescriptor.version=master&api-version=5.0"
$ItemlistInfo = (Invoke-RestMethod -Uri $Itemlisturl -Method Get -UseDefaultCredential -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}) 

$ItemlistName= $ItemlistInfo.value.path


Write-Host "The list items of the branch master is = $($ItemlistName | ConvertTo-Json -Depth 100)"