From 0b8ab60a2adda7cccbb9f0202b5159904d3cdf5a Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 9 Aug 2022 16:00:20 -0400 Subject: [PATCH 1/2] Add documentation about pagination of the API --- docs/content/doc/developers/api-usage.en-us.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/content/doc/developers/api-usage.en-us.md b/docs/content/doc/developers/api-usage.en-us.md index dd2822e9f1361..0ec1a8ba70cb3 100644 --- a/docs/content/doc/developers/api-usage.en-us.md +++ b/docs/content/doc/developers/api-usage.en-us.md @@ -105,6 +105,18 @@ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \ As mentioned above, the token used is the same one you would use in the `token=` string in a GET request. +## Pagination + +The API supports pagination. The `page` and `limit` parameters are used to specify the page number and the number of items per page. As well, the `Link` header is returned with the next, previous, and last page links if there are more than one pages. The `x-total-count` is also returned to indicate the total number of items. + +```sh +curl -v http://localhost/api/v1/repos/search\?limit\=1 +... +< link: ; rel="next",; rel="last" +... +< x-total-count: 5252 +``` + ## API Guide: API Reference guide is auto-generated by swagger and available on: From a4a4375c4517e8ea482e90b001e8c4585faa74fb Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 9 Aug 2022 21:58:43 -0400 Subject: [PATCH 2/2] Update docs/content/doc/developers/api-usage.en-us.md Co-authored-by: wxiaoguang --- docs/content/doc/developers/api-usage.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/developers/api-usage.en-us.md b/docs/content/doc/developers/api-usage.en-us.md index 0ec1a8ba70cb3..1ff912353fed2 100644 --- a/docs/content/doc/developers/api-usage.en-us.md +++ b/docs/content/doc/developers/api-usage.en-us.md @@ -110,7 +110,7 @@ the `token=` string in a GET request. The API supports pagination. The `page` and `limit` parameters are used to specify the page number and the number of items per page. As well, the `Link` header is returned with the next, previous, and last page links if there are more than one pages. The `x-total-count` is also returned to indicate the total number of items. ```sh -curl -v http://localhost/api/v1/repos/search\?limit\=1 +curl -v "http://localhost/api/v1/repos/search?limit=1" ... < link: ; rel="next",; rel="last" ...