List an EPUB's chapters
GET /assets/{id}/epub/spine
Lists the chapters of an EPUB asset in reading order, one entry for
each item in the book’s spine. Pass an entry’s idx to GET /assets/{id}/epub/chapters/{idx} to read that chapter.
A chapter’s label is taken from the book’s table of contents where
possible, otherwise from its first heading, its title or its
manifest id. The table of contents is read only from a navigation
document or NCX file that the manifest lists under the id toc or
ncx. A label that looks like a file name or a short code becomes
“Chapter N”, with N = idx + 1, so a short one-word title such as
“Prologue” can be replaced as well.
You need to be signed in, and any account can list any EPUB asset’s chapters. The list is cached per asset and not refreshed, so a cached list can still be returned after the asset is deleted, for as long as its entry stays in the cache. Otherwise a 404 means no asset has that id, it’s in the trash or it has no stored file. A file that can’t be read as an EPUB gets a 500, as JSON or, for some broken files, as plain text.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The id of the EPUB asset.
Responses
Section titled “ Responses ”The chapters, in reading order.
One chapter of an EPUB, in reading order.
object
The chapter’s position in the reading order, starting at 0. Pass it to GET /assets/{id}/epub/chapters/{idx}.
The name to show for the chapter: its table-of-contents entry, its first heading or title, or its manifest id. A value that looks like a file name or a short code is replaced with “Chapter N”, where N is idx + 1.
The chapter file’s path as the manifest gives it, relative to the book’s package file.
The chapter file’s media type as the manifest declares it; it isn’t checked against the file.
Example
application/xhtml+xmlAuthentication required, missing, or invalid
object
Human-readable error summary
Example
the request could not be completedExample
{ "error": "authentication required: sign in and retry with a valid session or API token"}Resource not found
object
Human-readable error summary
Example
the request could not be completedUnexpected server error
object
Human-readable error summary
Example
the request could not be completed