Reputation: 167
I want to list application's all branches in front side and want the list can be ordered by branch last commit time.
But currently there are two questions :
Is anyone know if there are some unpublic parameters to resolve my problem?
Thanks.
Upvotes: 3
Views: 4252
Reputation: 41
gitlab Restful api get Branches:
/api/v4/projects/{git_id}/repository/branches
https://docs.gitlab.com/ee/api/branches.html
support params: page
per_page
sort
search
/api/v4/projects/{git_id}/repository/branches?page=1&per_page=100&sort=updated_desc
can resolve "How to get branches order by commit_time"
Upvotes: 4
Reputation: 2353
In general, you will have a better chance of getting an answer if there is only one question per post. In any case,
Is anyone know if there are some unpublic parameters to resolve my problem?
There are no, as far as I know, private parameters in the GitLab API. They should all be listed in the API documentation.
gitLab api return 20 branches by default, I searched that add per_pages can return more branches.
Indeed, you can change the per_page
parameter to return up to a maximum of 100 items per page, and/or use pagination in your client.
gitLab api is ordered by name.
Looking at the branches API documentation it would seem that that is the only sorting available.
In that case, one option is to do the sorting on your client: you can use the branches API to list the branches, and the commits API to fetch the commits of each branch and then determine the last commit to do the sorting.
I hope that helps!
Upvotes: 0