-1

I am trying to download a blobbed zip for a repository on the Azure DevOps Server 2019 API using the following documentation.

https://learn.microsoft.com/en-us/rest/api/azure/devops/git/blobs/get%20blobs%20zip?view=azure-devops-server-rest-5.0

The request body is supposed to contain:

REQUEST BODY
Name    Type     Description
body    string[] Blob IDs (SHA1 hashes) to be returned in the zip file.

How can I obtain the blob ids?

doorman
  • 15,707
  • 22
  • 80
  • 145
  • 1
    The blobs are SHA1 hashes of files that you want to download. Look at the other available APIs to determine how to retrieve a list of files with associated hashes. – Daniel Mann Jun 30 '20 at 17:03
  • Hi @DanielMann is there a way to download the whole repository, basically the zip file you can download from the DevOps repo page? – doorman Jun 30 '20 at 19:02
  • 1
    Why can't you just do git clone --mirror to clone a copy of the repo? – Daniel Mann Jun 30 '20 at 19:03
  • Thanks for the suggestion I will have a look at that. I assumed I could download a zip file containing the whole solution, I did that when I was using the vstfs api. But Git is different doing a clone programatically is possibly the way to go. – doorman Jun 30 '20 at 19:08

1 Answers1

1

How can I obtain the blob ids?

You can try Items-List api to obtain the blob ids:

GET https://{instance}/{collection}/{project}/_apis/git/repositories/{repositoryId}/items?recursionLevel=Full&api-version=5.0

The response:

enter image description here

Also, if you're trying to get the IDs programatically, you can use GitHttpClientBase.GetItemsAsync Method .

Ps: As Daniel commented above, it's more recommended to use git command to download whole repository. So you can also try to call git-related api in your code if you want to do that programatically. There're many discussions online about this topic, like this.(Since it's not your original question about Blobids, I won't talk too much here.)

LoLance
  • 25,666
  • 1
  • 39
  • 73