Skip to content

Commit 1a538df

Browse files
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 <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
1 parent 77d7b4c commit 1a538df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/content/doc/developers/api-usage.en-us.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
105105
As mentioned above, the token used is the same one you would use in
106106
the `token=` string in a GET request.
107107
108+
## Pagination
109+
110+
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.
111+
112+
```sh
113+
curl -v "http://localhost/api/v1/repos/search?limit=1"
114+
...
115+
< 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"
116+
...
117+
< x-total-count: 5252
118+
```
119+
108120
## API Guide:
109121
110122
API Reference guide is auto-generated by swagger and available on:

0 commit comments

Comments
 (0)