BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

[API Request]: Complete Book data as JSON

Open amelszg opened this issue 3 years ago • 1 comments

API Endpoint or Feature

I would like to be able to fetch complete book data (with all chapter and page details, page html content included) with single API call.

Can't exactly pinpoint what the most suitable place for this API call would be, my first hunch would be an additional export method.

/api/books/{id}/export/json

Alternatively, being able to fetch list of API "read" page results as single call would be fine as well, but not sure where such call would fit in the API.

Whatever requires least effort and maintenance to implement.

Use-Case

Fetch details for all pages via single API call to avoid making a hundreds of separate calls (1x per page).

Additional context

Json Export result would contain complete book data and would basically aggregate JSON output of current API methods:

  • "read" book result
  • collection of "read" chapter results
  • collection of "read" page results

I'm mainly in need to fetch all html content of all book pages at once. Using html export involves considerable overhead with parsing and replacing the content, since it's not the same html result as returned via page detail html property (images are embedded, there is no clear separation which html fragments belong to specific page or pageid, etc.)

amelszg avatar Dec 13 '21 08:12 amelszg

For me it would be enough to be able to fetch all pages with their content. I would like to create a blog page. This pages lists all pages of an bookstack chapter with header and preview and click on details shows the full page. Currently the api-call pagesonly gets you the title. If you want to show the content or preview, you have to make an api call for each page pages/:id and fetch that information.

Maybe something like /pages?with_content=true

The above request goes into a similar direction. That would be something like books/:id?with_content=true

Skulli avatar Aug 22 '22 09:08 Skulli