How do I get a repository tree recursively using the Gitlab API?


#1

How do I get a repository tree recursively using the Gitlab API?


#2

Not sure if there are better ways to do this if you want all blobs (files) rather than just directories:


I will need to post and ask if this feature is available.

To get all ‘trees’ (directories) recursively:
http://gitlab.YOURDOMAIN.com/api/v4/projects/:id/repository/tree?recursive=true
eg.

id (if your repo name is for example 1580

http://gitlab.YOURDOMAIN.com/api/v4/projects/1580/repository/tree?recursive=true

url-encoded project name
http://gitlab.YOURDOMAIN.com/api/v4/projects/PROJECT%2FREPO_NAME/repository/tree?recursive=true

NOTE that the %2F replaces ‘/’ due to the project name being url-encoded!!