1 =======================================================
2 ``PATCH https://bosh.pageplace.de/bosh/rest/sync-data``
3 =======================================================
4 Send changes to the server and get changes since last sync back.
5 This is the main API method for synchronization.
7 Part of the `Sync process`_.
12 Similar to `bosh v1 header set`_, but not exactly the same.
13 Uses ``reseller_id`` instead of ``m_id`` and does not send the ``client_version``.
16 OAuth token obtained from `POST https://thalia.de/auth/oauth2/token`_.
18 Example: ``eyJhbGciOiJSUzI1NiJ9.eyJhdWRpZW5jZSI6InRyZWFkZXJ2aXNpb24zIiw...``
20 ``application/json; charset=UTF-8``
22 ``application/json; charset=UTF-8``
26 Example: ``665fc389ef4e47258c5db9fa7821bd19``
28 Example: ``TOLINO_VISION_3``
31 Example: ``publications``
34 Request body parameters
36 ``revision`` of last sync response.
38 ``null`` when it is the first sync ever for this device.
42 No data to sync: Empty array ``[]``.
44 Changes are objects with the following properties:
47 The patch operation: ``add``, ``replace``, ``remove``
49 ``replace`` is used to update the reading position.
52 Example: ``/publications/DT0400.9783739673417_A27522964/bookmark/606779074``
54 Consists of several parts:
56 1. The prefix seems always to be ``/publications/``.
57 2. A publication ID ``DT0400.9783739673417_A27522964``
58 3. The type that is created/updated/deleted:
60 - ``bookmark`` is the reading position
61 - ``dogears`` when bookmarking a page in the e-book
62 - ``comments`` when highlighting/marking some text or adding a note
66 Details of the change. Properties depend on the type.
69 Time when this action was done in milliseconds. Type: Integer.
71 Example: ``1612127562802``
73 File name of the chapter in the epub,
74 plus specific data in the anchor. Type: String.
76 Example: ``OEBPS/caterina-di-montebasso-das-relikt_0.html#point(/1/2/1/11/1:114)``
80 FIXME: Can be ``null``. When?
82 The patch part revisions share some prefix with the patch revision,
84 Seem to be base64-encoded, since the often (always?) have ``==`` at the end.
86 In the response, the patch part revisions also share some prefix with
87 the new server revision.
89 Example: ``Lmu7TngaxhKWHdv2FFktQNcGFPmnOshpANcqFEx7udpEDvQDdiq93W8ryZG4oSfm9D9sp2Aowkhu/1wg8qj4PglnxUFM96DOLgZMd9NVnTByM/ZG1vgkHHCrqwpA/7bO67OjTjo1TLKVL442Lx3sGw==``
91 Reading progress in the ranging from 0-1. Type: Float.
93 Only for ``bookmark`` (reading position) patches.
95 Example: ``0.41666666``
97 Current page number. Type: String.
99 Only for ``bookmark`` (reading position) patches.
103 Last page number in the book. Type: String
105 Only for ``bookmark`` (reading position) patches.
111 Only when ``op=add`` on ``dogears`` (bookmark) and ``comments``.
115 Text on the bookmarked page. Type: String.
117 Only for ``dogears`` (bookmark) add+remove operations.
119 Highlighted text. Type: String
121 Only for ``comments`` (highlight/note) add+remove operations.
123 Start of highlighted text. Type: String.
125 Only for ``comments`` (highlight/note) add+remove operations.
127 Example: ``OEBPS/caterina-di-montebasso-das-relikt_0.html#point(/1/2/1/11/1:463)``
129 End of highlighted text. Type: String.
131 Only for ``comments`` (highlight/note) add+remove operations.
133 Example: ``OEBPS/caterina-di-montebasso-das-relikt_0.html#point(/1/2/1/11/1:682)``
135 Manually entered text (note). Type: String.
137 Only for ``comments`` (note) add+remove operations.
139 Property does not appear for non-note highlights.
144 When closing a book (going back to the book list), the current reading
145 position is synchronized to the server - regardless if it changed.
146 I removed that from the requests + responses to have cleaner examples.
148 The ``revision`` in the request is the ``revision`` the server returned
149 in the last response.
154 When nothing needs to be synchronized to the server, and nothing
155 ever has been synchronized:
157 .. include:: pageplace.bosh-bosh-rest-sync-data.request-first.json
163 Reading a page in the book and exiting back to the books list:
165 .. include:: pageplace.bosh-bosh-rest-sync-data.request-reading-position.json
172 HTTP status code: ``200 OK``
174 When something changed, a new ``revision`` number is returned.
176 When synchronizing local changes to the server - and the server has no
177 changes from other readers,
178 the request is mirrored back in the response
179 (only the revision number is updated).
181 The server first ingests the request's patch data into its database,
182 and then calculates and returns the changes from the
183 requests's ``revision`` number to the current revision.
184 Those changes are returned in the response, together with the current
185 latest revision number.
187 Same structure as the request data.
192 The "Set reading position" changes and a new revision is returned.
194 .. include:: pageplace.bosh-bosh-rest-sync-data.response-reading-position.json
201 .. include:: pageplace.bosh-bosh-rest-sync-data.response-bookmark-set.json
208 .. include:: pageplace.bosh-bosh-rest-sync-data.response-bookmark-remove.json
215 .. include:: pageplace.bosh-bosh-rest-sync-data.response-highlight-add.json
222 .. include:: pageplace.bosh-bosh-rest-sync-data.response-highlight-remove.json
229 .. include:: pageplace.bosh-bosh-rest-sync-data.response-note-add.json
236 .. include:: pageplace.bosh-bosh-rest-sync-data.response-note-remove.json
240 New bookmarks and comments
241 --------------------------
244 .. include:: pageplace.bosh-bosh-rest-sync-data.response-bookmarks-comments.json