Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/content/docs/api/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,23 @@ for navigating between pages.
**Link header example:**

```http
Link: <https://api.mergify.com/v1/repos/Mergifyio/my-repo/logs?cursor=abc&per_page=20>; rel="next",
<https://api.mergify.com/v1/repos/Mergifyio/my-repo/logs?cursor=xyz&per_page=20>; rel="last",
<https://api.mergify.com/v1/repos/Mergifyio/my-repo/logs?cursor=def&per_page=20>; rel="first"
Link: <https://api.mergify.com/v1/repos/<owner>/<repository>/logs?cursor=abc&per_page=20>; rel="next",
<https://api.mergify.com/v1/repos/<owner>/<repository>/logs?cursor=def&per_page=20>; rel="prev"
```

The `Link` header may include the following relations:

- `next`: The next page of results
- `prev`: The previous page of results
- `first`: The first page of results
- `last`: The last page of results

Each relation appears only when that page exists: `next` is absent on the last
page, `prev` on the first. The two are independent, and a middle page carries
both. When neither applies — a result set that fits on a single page — the
`Link` header is omitted entirely.

To iterate through all pages, follow the `rel="next"` link
until it is no longer present in the response.
until it is no longer present in the response. To get back to the first page,
call the endpoint again without a `cursor`.

## Error Handling

Expand Down