通过 TFS 2015 RestFul APIs 从 Version Control 下载整个文件夹 [英] Download entire folder from Version Control via TFS 2015 RestFul Apis
问题描述
有没有办法使用 RestFul api 从 TFS 2015 版本控制中获取整个文件夹的下载 url?
Is there a way to get the download url for an entire folder from TFS 2015 Version Control using the RestFul apis?
我可以通过 /_apis//tfvc/items/
api 获取有关项目的元数据,但没有可用的 downloadUrl
属性.
I can get metadata about items via the /_apis//tfvc/items/
api, but no downloadUrl
property is available.
我可以通过 /_apis//build/builds/{buildNumber}/artifacts
api 查看构建工件的 downloadUrl
属性.
I can see the downloadUrl
property for build artifacts via the /_apis//build/builds/{buildNumber}/artifacts
api.
我可以通过该项目的 GET api 下载文件夹中的每个文件,但这可能需要大量请求.
I could download every file in the folder via the GET api for that item, but that could require a lot of requests.
我使用的是 API 2.0 版.
I am using api version 2.0.
推荐答案
当前版本控制 API 的项目/文件夹没有任何下载 url.
There isn't any download url for items/folders with currently Version Control API.
要获取整个文件夹,您可以将其压缩并使用以下格式的 Rest Api 下载:
To get an entire folder, you can zip it and download it with the Rest Api with following format:
[Get] https://xxx/defaultcollection/_apis/tfvc/items?path=<Folder Path>&api-version=1.0
并在请求头中添加以下内容:Accept: application/zip
And add following in the request header: Accept: application/zip
这篇关于通过 TFS 2015 RestFul APIs 从 Version Control 下载整个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!