无法通过 TFS 2015 RestFul Apis 下载 zip 文件夹
Unable to download folder as zip 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!");
});
});
请尝试以下 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
这是与以下相关的跟进问题:
我试图用节点实现一个 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!");
});
});
请尝试以下 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