REST api in gitlab not working

Hello everyone,

I want to access the files inside a project hosted in gitlab ce server 8.0 with a rest api call.

I used the below api

http://gitlabserver/api/v3/projects/<project id>/repository/tree?private_token=token id

which returns me the project with the immediate children.

for example if the project structure is A
|__ .project
|__ src
|__ myfile

, it returns…project and src.

As per the Gitlab api documentation if the file path is specified in the above query it should return the subfolders but I always get 404 error.

I tried below combinations,

http://<gitlab server>/api/v3/projects/<project id>/repository/tree?private_token=<token id>&file_path=path


http://<gitlab server>/api/v3/projects/<project id>/repository/tree&file_path=path?private_token=<token id>

But it always returns 404 error. Can anyone suggest the right way to get the files inside a gitlab project.


Similar problem for me, allthough I don’t think the thread title helps get a solution. Also, the current documentation says path not file_path (though it makes no difference to the issue for me).

It seems not many people are using this feature given the lack of replies.

@Santhosh did you find a solution? I am trying this with curl in PHP so my issue may be different

I know I am late in getting in this thread. Perhaps you have resolved your issue, but even so perhaps others might benefit from my solution

You should uuencode the path. For example, “Assets/Plant.jpg” should be “Assets%2fPlant.jpg”