问题
I'm developing a plugin in Visual Studio Code that allows downloading of artifacts from VSTS (Visual Studio Team Services) but I don't know where to get the URL? How can I get the URL of the download button?

回答1:
You can get the download URL for build artifacts through REST API.
Use the REST API to get build artifacts:
GET https://{account}.visualstudio.com/DefaultCollection/{project}/_apis/build/builds/{buildID}/artifacts?api-version=2.0
You will get the response as below:
{
"count": 1,
"value": [
{
"id": 270,
"name": "drop",
"resource": {
"type": "Container",
"data": "#/514582/drop",
"properties": {
"localpath": "D:\\Agent\\newTFSPCagent\\_work\\3\\a"
},
"url": "https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/1581/artifacts?artifactName=drop",
"downloadUrl": "https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/1581/artifacts?artifactName=drop&%24format=zip"
}
}
]
}
For the value of downloadUrl
(as https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/1581/artifacts?artifactName=drop&%24format=zip
in above example) is what you need.
来源:https://stackoverflow.com/questions/46519049/how-to-get-the-download-url-of-the-artifact-in-visual-studio-team-services