Add book and chapter title in the response of /api/search/ endpoint #4892

Closed
opened 2026-02-05 09:24:07 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @adimesic on GitHub (Jul 23, 2024).

API Endpoint or Feature

Is it possible to add the book and chapter title in the response of the /api/search endpoint? Right now, the response only shows the book_id and chapter_id if the type value is a page.

As a workaround, I loop through the response of /api/search and hit the /api/books/{id} endpoint every time to get the book title. The same for chapters also. I need to hit the /api/chapters/{id} endpoint to get the chapter title.

Use-Case

I use the api/search endpoint for an external site to access a KB (knowledge Base) that is using BookStack. Both the external site and my instance of BookStack are not publicly available. As I mentioned earlier, as a workaround I need to loop trough the response of the /api/search endpoint to fetch the book and chapter titles from the API so that the external site can consume my custom endpoint with all the necessary data. It is slow and very tedious, so the inclusion of the book and chapter titles in the search response would be great.

Additional context

I don't know if the inclusion of the book and chapter title would be a performance hit, but I assume it could be an optional parameter (or flag) set in the /api/search endpoint. Lets say a query parameter that would indicate to include the title of the book and chapter in the response.

Originally created by @adimesic on GitHub (Jul 23, 2024). ### API Endpoint or Feature Is it possible to add the book and chapter title in the response of the /api/search endpoint? Right now, the response only shows the book_id and chapter_id if the type value is a page. As a workaround, I loop through the response of /api/search and hit the /api/books/{id} endpoint every time to get the book title. The same for chapters also. I need to hit the /api/chapters/{id} endpoint to get the chapter title. ### Use-Case I use the api/search endpoint for an external site to access a KB (knowledge Base) that is using BookStack. Both the external site and my instance of BookStack are not publicly available. As I mentioned earlier, as a workaround I need to loop trough the response of the /api/search endpoint to fetch the book and chapter titles from the API so that the external site can consume my custom endpoint with all the necessary data. It is slow and very tedious, so the inclusion of the book and chapter titles in the search response would be great. ### Additional context I don't know if the inclusion of the book and chapter title would be a performance hit, but I assume it could be an optional parameter (or flag) set in the /api/search endpoint. Lets say a query parameter that would indicate to include the title of the book and chapter in the response.
OVERLORD added the 🔩 API Request label 2026-02-05 09:24:07 +03:00
Author
Owner

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

Thanks to @rashadkhan359 for starting it off in #5280, this has now been added and will be part of the next feature release.
Thanks @adimesic for the original request.

@ssddanbrown commented on GitHub (Dec 3, 2024): Thanks to @rashadkhan359 for starting it off in #5280, this has now been added and will be part of the next feature release. Thanks @adimesic for the original request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4892