I am able to retrieve the commits for a file using the below URL.
https://gitlab.aws.site.domain.com/api/v4/projects/68456/repository/commits?path=testflow/flow.java
But adding the optional parameter all, ends up with empty array.
https://gitlab.aws.site.domain.com/api/v4/projects/68456/repository/commits?path=testflow/flow.java&all=true
Calling with just path will get me latest results ? and is all not for all commits across branches. I thought if ref_name is not passed it takes the default. I tried the above apis with ref_name too but the same responses.
The
allparameter is not compatible with thepathparameter. You must use thepathparameter without using theallparameter.If there are many changes to the file, you need to paginate over the API results using multiple requests. This applies to virtually all API endpoints within GitLab that will return more than 20 results.
For example, the URL
https://gitlab.com/api/v4/projects/278964/repository/commits?path=.gitlab-ci.ymlwill return the first 20 results from the API. To get the next 20 pages, you will add thepageparameter with the next page number:?path=.gitlab-ci.yml&page=2for the second page?path=.gitlab-ci.yml&page=3for the third pageYou can use the response headers to know what the next page to request is.
You may also configure the
per_pagearguments, as described in the API docs e.g.,?path=.gitlab-ci.yml&page=1&per_page=100