Skip to content

Commit

Permalink
Add documentation about pagination of the API (go-gitea#20740)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
2 people authored and Sysoev, Vladimir committed Aug 10, 2022
1 parent ddfdd85 commit 20c3208
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/content/doc/developers/api-usage.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 20c3208

Please sign in to comment.