尝试使用GitLab API获取项目下的所有分支,但我看到只返回了20个分支。我怎样才能得到所有分支机构的完整列表?我正在使用以下API。
curl --header "PRIVATE-TOKEN: <token>" "https://gitlab.com/api/v4/projects/1521/repository/branches"发布于 2022-11-26 16:41:01
在官方的Gitlab API文档中找到分页下的解决方案,默认情况下我们得到20个结果,我们可以在我们的per_page链接中使用per_page来增加结果的数量,如下所示。
https://gitlab.com/api/v4/projects/<Project_id>/repository/branches?per_page=50发布于 2022-11-26 17:07:22
获得分支只限于20个分支。为了获得所有分支,请使用以下查询参数:
https://gitlab.com/api/v4/projects/2009901/repository/branches/?page=2
https://gitlab.com/api/v4/projects/2009901/repository/branches/?per_page=100文档可以在这里找到:https://docs.gitlab.com/ee/api/#pagination
不幸的是,在分支API文档中缺少这一点:https://docs.gitlab.com/ee/api/branches.html。
https://stackoverflow.com/questions/74582137
复制相似问题