这是与download-entire-folder-from-version-control-via-tfs-2015-restful-apis
有关的后续问题我试图用节点来实现Rest解决方案,以将项目文件夹下载为zip,但是上述解决方案似乎无法正常工作。有人可以帮忙吗?
var request = require('request');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
const options = {
url: 'https://dev.azure.com/myproject/Project-TFS/_apis/tfvc/items?path=%24%2Project-TFS%2FTesting%2Fsrc&api-version=4.1',
method: 'GET',
headers: {
'Accept': 'application/zip',
'Authorization': 'Basic c2F1cmFqYWlzd2FsQGRlbG9pdHRlLmNvbMmc2YTVhczZnajdwbmVsNW5kYXA0dnNucm1qdTJya2J2eXpx'
}
};
request(options, function(err, res, body) {
alert('done');
var output = "project.zip";
if(err) throw err;
fs.writeFile(output, body, function(err) {
alert("file written!");
});
});
答案 0 :(得分:1)
请尝试以下REST API:
对于Azure DevOps:
https://dev.azure.com/{organization}/{ProjectName or ID}/_apis/tfvc/Items?path=%24%2Project-TFS%2FTesting%2Fsrc&%24format=zip&api-version=4.1-preview.1
对于本地TFS 2015:
http://SERVER:8080/tfs/DefaultCollection/{ProjectName or ID}/_api/_versioncontrol/itemContentZipped?repositoryId=&path=%24%2Project-TFS%2FTesting%2Fsrc