API: Attempting to retrieve more than 500 pages #4850

Closed
opened 2026-02-05 09:20:46 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @ShajeeAmjad on GitHub (Jul 3, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I'm using the API to get a list of all pages from my bookstack site. It currently has over 650 pages, but the limit from the listing endpoints (from what I saw on the API docs) is 500. I wanted to know if there is any way I can set a custom limit to whatever I want

Exact BookStack Version

Bookstack latest version

Log Content

No response

Hosting Environment

PHP8.1, Ubuntu 22.04

Originally created by @ShajeeAmjad on GitHub (Jul 3, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I'm using the API to get a list of all pages from my bookstack site. It currently has over 650 pages, but the limit from the listing endpoints (from what I saw on the API docs) is 500. I wanted to know if there is any way I can set a custom limit to whatever I want ### Exact BookStack Version Bookstack latest version ### Log Content _No response_ ### Hosting Environment PHP8.1, Ubuntu 22.04
OVERLORD added the 🐕 Support label 2026-02-05 09:20:46 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jul 3, 2024):

Hi @ShajeeAmjad,
Technically there is a API_MAX_ITEM_COUNT option, but I don't recommend increasing this as a solution to your scenario.
It would be better to handle paging in your application, to properly cycle through pages of API data so that you're keeping to reasonable sizes of data handling, and to be flexible in regards to counts.

If you need an example, here's a PHP function that gets all books via paging over the API:

8e94a530b0/php-export-all-books/export-books.php (L47-L64)

@ssddanbrown commented on GitHub (Jul 3, 2024): Hi @ShajeeAmjad, Technically there is a `API_MAX_ITEM_COUNT` option, but I don't recommend increasing this as a solution to your scenario. It would be better to handle paging in your application, to properly cycle through pages of API data so that you're keeping to reasonable sizes of data handling, and to be flexible in regards to counts. If you need an example, here's a PHP function that gets all books via paging over the API: https://github.com/BookStackApp/api-scripts/blob/8e94a530b0dfb5caebab8b410a893f960f79e089/php-export-all-books/export-books.php#L47-L64
Author
Owner

@ssddanbrown commented on GitHub (Jul 14, 2024):

Since an answer was provided I'll go ahead and close this off.

@ssddanbrown commented on GitHub (Jul 14, 2024): Since an answer was provided I'll go ahead and close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4850