How to download root directory

I am interested in downloading all the contents of a repository.
I have seen that to download a directory, I can do as suggested in the docs.
The first step is to get a task token.

This requires us to specify:

  • parent_dir
  • dirents

When trying to download a subdir (e.g. “/dir1/dir2”) I would specify this as:
parent_dir = “/dir1”
dirents = “dir2”

But when I want to to download everything in that repo, i.e. the root diretory ("/", how do I specify these parameters? I have tried setting each to “/” while the other is blank, but I get 500 error. If I omit one of these parameters, then I get 400 error.

What is the right way to download the entire repo?
Is there an example I can find somewhere?

For downloading all the contents of a repository, you should use the zip-task web api like this.

Set each item in the root folder as dirents parameter.


1 Like

Thanks you for the solution.

I had a query regarding the outcome of this process. The docs says that we get an output of the form:

{    "zipped":2,    "total":2}

when querying the task progress. In practice, I get:


I wanted to know if there are any scenarios where “zipped != total” but owing to failure, and not because I need to wait longer for the task to be completed.

In other words, how can I identify if the task has comlpleted, but owing to some error/problem the final value of zipped != total.