API problem: Get url to specific file version/ content of file from specific commit
Summary
I'm looking for any way to get content of file from specific commit by Gitlab API (preferable as URL).
What i find
Currently I find 2 ways to get file content from specific commit.
First approach
https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions Using commit with multiple file I can prepare a commit structure --data/--form and execute request. Response contains e.g. commit id which will be used further: GET /projects/:id/repository/files/:file_path/raw?ref=commitId The problem with this approach is related to the structure of the commit, which can't be simple string.
Is there any way to pass commit in simple string format ??
Second approach
Use simple post request following instruction in https://docs.gitlab.com/ee/api/repository_files.html#create-new-file-in-repository. In response we get only file_path and branch. To get file content from that "commit" I need to execute GET /projects/:id/repository/commits?path=file_path, filter them by specific user, take last commit and use commitId to execute GET in a similar way to that of the first approach. The problem with this approach is with GET /projects/:id/repository/commits. Even with some filtering by file_path, after some time number of commits can be too big for reasonable response time.
Conclusion
Is there any approach which don't have those problems/issues ? I need simple POST request with string as argument.