diff options
author | techknowlogick <techknowlogick@gitea.io> | 2022-08-09 21:58:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 21:58:55 -0400 |
commit | 1a538df5f449edc12c4122346c5aaa63efb0fb6f (patch) | |
tree | df474692d6a6693e608b3a1e5d0883535ad23b00 /docs | |
parent | 77d7b4c63dac8328dc2a67c9936b7fce8df0a482 (diff) | |
download | gitea-1a538df5f449edc12c4122346c5aaa63efb0fb6f.tar.gz gitea-1a538df5f449edc12c4122346c5aaa63efb0fb6f.zip |
Add documentation about pagination of the API (#20740)
* Add documentation about pagination of the API
* Update docs/content/doc/developers/api-usage.en-us.md
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/doc/developers/api-usage.en-us.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/content/doc/developers/api-usage.en-us.md b/docs/content/doc/developers/api-usage.en-us.md index dd2822e9f1..1ff912353f 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: <http://localhost/api/v1/repos/search?limit=1&page=2>; rel="next",<http://localhost/api/v1/repos/search?limit=1&page=5252>; rel="last" +... +< x-total-count: 5252 +``` + ## API Guide: API Reference guide is auto-generated by swagger and available on: |