Dev
Mock Pagination Link Generator
Pagination bugs often hide at the edges — the first page, the last page, and the transition between them. To test those edge cases without a live backend, you need a realistic links object that a paginated API would return. This tool generates the standard HATEOAS-style pagination links for any page number you choose. Enter the current page and the generator produces a JSON object with five keys: self, first, prev, next, and last. The base URL is https://api.example.com/items?page=. The prev link is correctly null when the current page is 1, which gives you a ready-made edge-case fixture. The last page is set to current + 5 as a realistic stand-in for total page count. Paste the output into a mock server, a fixture file, or a unit test for your pagination component. Try page 1 to test the null prev path and verify your client handles it correctly. Try a higher page number to test mid-range navigation.
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Enter the current page number.
- Click Generate to produce pagination links.
- Copy the JSON into your mock or fixture.
- Try page 1 to test the null prev edge case.
Use Cases
- •Mocking a paginated API response
- •Testing pagination UI and controls
- •Building a client that follows link relations
- •Fixtures for infinite-scroll logic
- •Exercising first/last page edge cases
Tips
- →Test page 1 and the last page for edge cases.
- →Match the link relations to your real API.
- →Wrap the links in your standard response envelope.
- →Pair with a mock-pagination-response generator for full data.
FAQ
what are pagination links in a REST API
They are URLs an API returns — typically first, prev, next, and last — that let a client navigate pages of results without constructing URLs itself. This HATEOAS-style pattern keeps clients decoupled from the paging scheme.
why is the prev link sometimes null
On the first page there is no previous page, so the prev link is null. Generating that correctly lets you test how your client handles the edges of a result set — the very behaviour pagination bugs tend to hide in.
how is the last page number determined
The generator sets the last page to the current page plus five. This is a fixed offset used to produce a plausible total, not a real record count. For testing purposes it gives your client a non-trivial last page to navigate toward.
You might also like
Popular tools from other categories that share themes with this one.
Try these next
More free tools from other corners of the catalog, picked by shared themes.