Get raw file from repository

Viewed 6484

I want to get a file content in gitlab by using its api. Firstly, I check my gitlab version, its written as, GitLab Community Edition 9.4.3 b125d21 update asap

Then I create a private token and http://gitadress/api/v4/projects/id/repository/files?private_token=PRIVATE_TOKEN returns as;

{"error":"404 Not Found"}

then I modify the query as;

http://gitadress/api/v4/projects/222/repository/tree?private_token=PRIVATE_TOKEN this request returns as;

[{"id":"8078365d80c","name":"test.js","type":"blob","path":"test.js","mode":"100644"}]

What I want is to get the content of the test.js but whatever I tried I couldn't achieve it.

http://gitadress/api/v4/projects/id/repository/tree/test.js/raw?private_token=PRIVATE_TOKEN&ref=master returns as;

{"error":"404 Not Found"}

How can I get the raw file content by using gitlab api? Documentation is here; https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repository_files.md#get-raw-file-from-repository

1 Answers
Related