Skip to content

# Kobo Sync doc

Laurent Constantin edited this page Aug 17, 2024 · 3 revisions

Aim of this repo is to upstream developments for https://github.com/biblioverse/biblioteca especially regarding Kobo Sync.

Kobo Sync process

  1. Call /v1/initialization with the last token bearer, this will return the list of all endpoint that the kobo can use.
  2. Call /v1/user/profile Get the user's profile or token (we do a 307 here)
  3. Call /v1/user/loyalty/benefits Get benefits (not implemented)
  4. Call /v1/deals Get deal (not implemented)
  5. Call /v1/assets?DiffRequests=%5B%7BKey:EPD-KoboPlus-ReadOnly-NeverSubscribed,ETag:W/NjM4NTI0ODczNzUwMDAwMDAwLTU4MTQ4%7D%5D To get the diff assets (not implemented)
  6. Call POST /v1/analytics/gettests This call is used to check connectivity. A TestKey is sent in the body and is expected on the response. Furthermore, the HTTP Header Connection: keep-alive is expected.
  7. PUT /v1/library/{{uuid}}/state This call is done for all books (one call per book with the UUID). It's pushing the reading progression of the book and bookmarks.
  8. GET /v1/library/sync?Filter=ALL&DownloadUrlFilter=Generic,Android&PrioritizeRecentReads=true This is the SYNC Endpoint !
  9. Get the whishlist (not implemented)
  10. Get some prices (not implemented)
  11. Get reading recommendations (not implemented)
  12. POST v1/analytics/event Post analytics events (we implement it to speed the sync process but we do not store any information)
  13. /v1/products/{{uuid}}/nextread Next read (not implemented)

The sync endpoint (See KoboSyncController)

When the Kobo calls the Sync Endpoint a specific header is sent kobo-synctoken this contains multiple information. (See SyncTokenParser)

  • version
  • lastModified
  • lastCreated
  • archiveLastModified
  • readingStateLastModified
  • tagLastModified
  • store_token

The calls to the sync endpoints are done as long as the header x-kobo-sync has the value continue (as opposed to done)

The sync endpoint returns a JSON with the following keys:

  • NewEntitlement New book, are added since last sync
  • ChangedEntitlement Book modified since last sync
  • NewTag New tags since last sync
  • ChangedTag Tags changed since last sync (We do consider that every tags are representing shelves in the current implementation)

Each time that you sync a book with your Kobo an entity of type KoboSyncedBook is created, so we can know if the book is considered as new or already synced.

You can reset the list of synced books, by setting the attribute force=1 while editing your KoboDevice entity in the admin.

Proxing request to the official store

Due to the fact that your Kobo sync with this project, you can not retrieve books stored on the official store. We do have a Work-In-Progress to "Proxy" each request to the official store. But it's not finished at the moment. Some calls are already proxied, other not. See usage of KoboStoreProxy for more details.