user3364161
user3364161

Reputation: 375

Get artifact information through VSTS API

In the VSTS API there's information on how to make GET requests, but I can't find anywhere in the release API information on the artifact that was attached. I'm using Postman to submit requests, but there is no data returned on artifacts anywhere in the response. How do I find it?

Artifact is attached: Artifact attached

Can't show full logs of the request, but the GET URI is https://xxxx.vsrm.visualstudio.com/xxxx/xxxx/_apis/Release/releases?api-version=4.0-preview.4&definitionId=76 and this returns a lot of information, but none on the artifact. Running a similar call but with /build/builds/artifacts returns information on the artifacts, but I can't access the information through the release API for some reason.

Edit: I found information on the artifact by adding the release ID to the URL.

Upvotes: 0

Views: 1258

Answers (2)

Marina Liu
Marina Liu

Reputation: 38106

To get artifacts by GET a release REST API, you can follow below steps:

  1. Use the request

    GET https://account.vsrm.visualstudio.com/project/_apis/Release/releases/{releaseID}
    
  2. Authorization with basic Auth

    You can use PAT or Alternate credential for the basic auth.

  3. Send request and get the artifact url through output

    Make sure the return status is 200 OK. Select Body -> Pretty -> JSON for the output. Search artifactSourceVersionUrl in the output, the value for id is the url to get the artifacts. such as the url is https://account.visualstudio.com/_permalink/_build/index?collectionId=fc52d179-f3fd-460b-adb1-5ac84bd0e765&projectId=f7855e29-6f8d-429d-8c9b-41fd4d7e70a4&buildId=1402 as below example.

    enter image description here

  4. Open the URL and get the artifacts

    The URL is the related build page, in the Artifacts Tab, you can download or explore the artifacts.

    enter image description here

Upvotes: 1

DenverDev
DenverDev

Reputation: 497

Did you try looking at the Get Build Artifacts section of the API? This will provide the name of the artifact as well as the download URL for that artifact as well:

GET https://{instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}/artifacts

Is there specific information that you are looking for that is not returned in this call?

Upvotes: 0

Related Questions