I have a bitnami VM with gitlab 6.1.0.0 and I'm trying to get the files of a specific project from the rest API.
I tried to do something like this:
http://<my-git-lab-server>/api/v3/projects/12/repository/files?private_token=<my_token>
Of course 12
marks the project id which exists. I got as a response 404 - page not found
(BTW - the customized 404 page of gitlab)
I saw in the documentation that you need to pass parameters. So I used tree
to get the files, like this:
http://<my-git-lab-server>/api/v3/projects/12/repository/tree?private_token=<my_token>
And I got for example this file (along with other files):
[... some files here ... , {"name": "test.py", "type": "blob", "mode": "100644", "id": <some-id-here>}]
Then I tried the same url as before and added the file_path
and ref
parameters as described in the documentation and it looked like this:
http://<my-git-lab-server>/api/v3/projects/12/repository/files?file_path=test.py&ref=master&private_token=<my_token>
I also tried "test.py"
(with quotations). I tried using master
as ref as this file is found in the master branch. Hope that's what I should put there.
Anyway, still getting 404 not found. I'm not sure how to get the file correctly.
The task is to copy some projects content to a new gitlab server (of a different version as well) - if that changes anything.