Read an EPUB chapter as HTML
GET /assets/{id}/epub/chapters/{idx}
Returns one chapter of an EPUB asset as a complete HTML document.
idx is the chapter’s position from GET /assets/{id}/epub/spine,
starting at 0.
The chapter file is parsed and written out again as HTML, so the
markup can differ from the file in the book. Relative URLs in
href, src and srcset attributes are rewritten to GET /assets/{id}/epub/resources/{path} URLs, links to other chapters
included; absolute URLs, paths starting with / and # links are
left as they are, and so are URLs in stylesheets and style
attributes. Rewritten URLs for files below the top level of the
archive don’t reach the resource route at the moment (see that
page).
The HTML isn’t cleaned: scripts, event handlers and links to other sites stay in it. Show it in a sandboxed frame that doesn’t allow scripts.
You need to be signed in, and any account can read any EPUB asset.
Each chapter is cached per asset and index and not refreshed, so a
cached chapter can still be returned after the asset is deleted, for
as long as its entry stays in the cache. A 404 means the asset or
the chapter wasn’t found, including an idx below 0 or past the
last chapter. An idx that isn’t a whole number gets a plain-text
400. Server errors usually get the JSON 500, but some get a
plain-text 500.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The id of the EPUB asset.
The chapter’s position in the reading order, starting at 0, as idx in the chapter list.
Responses
Section titled “ Responses ”The chapter as an HTML document.
Authentication 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