英文:
GitLab API v4 only collects less than 20 issue comments
问题
如果我在一个问题中收集所有问题,JSON字符串中只会显示20条评论。
原因: 默认分页
如果我在一个里程碑中收集所有问题,我可以使用参数per_page=100。
$ key="$PRIVATE_TOKEN"
$ proj_url="https://<URL>/api/v4/projects/$CI_PROJECT_ID"
$ curl -s --header "PRIVATE-TOKEN: $key" "$proj_url/issues?milestone=<MILESTONE NAME>&per_page=100"
我如何使用GitLab API收集所有问题备注?
$ key="$PRIVATE_TOKEN"
$ proj_url="https://<URL>/api/v4/projects/$CI_PROJECT_ID"
$ curl -s --header "PRIVATE-TOKEN: $key" "$proj_url/issues/193/notes"
英文:
If I collect all issues within an Issue only 20 comments will be shown in the JSON string.
Reason: Default Pagination
If I collect all Issues within an Milestone I can use the parameter per_page=100.
$ key="$PRIVATE_TOKEN"
$ proj_url="https://<URL>/api/v4/projects/$CI_PROJECT_ID"
$ curl -s --header "PRIVATE-TOKEN: $key" "$proj_url/issues?milestone=<MILESTONE NAME>&per_page=100"
How can I collect all issue notes with GitLab API?
$ key="$PRIVATE_TOKEN"
$ proj_url="https://<URL>/api/v4/projects/$CI_PROJECT_ID"
$ curl -s --header "PRIVATE-TOKEN: $key" "$proj_url/issues/193/notes"
答案1
得分: 1
The GitLab Notes API confirms that, by default, GET requests return 20 results at a time because the API results are paginated. But per_page=100 should still be available for this type of query.
The other option would be to use the GitLab CLI glab to make the same query with glab api, but with --paginate
In '--paginate' mode, all pages of results will sequentially be requested until there are no more pages of results.
英文:
The GitLab Notes API confirms that, by default, GET requests return 20 results at a time because the API results are paginated.
But per_page=100 should still be available for this type of query.
The other option would be to use the GitLab CLI glab to make the same query with glab api, but with --paginate
> In '--paginate' mode, all pages of results will sequentially be requested until there are no more pages of results.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论