Work in progress #5: Uploading and deleting own ebooks
authorChristian Weiske <cweiske@cweiske.de>
Sun, 7 Mar 2021 20:07:08 +0000 (21:07 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 7 Mar 2021 20:07:08 +0000 (21:07 +0100)
README.rst
api/pageplace.bosh-bosh-rest-content-delete.request.json [new file with mode: 0644]
api/pageplace.bosh-bosh-rest-content-delete.rst [new file with mode: 0644]
api/pageplace.bosh-bosh-rest-cover-xxx-yyy.rst [new file with mode: 0644]
api/pageplace.bosh-bosh-rest-cover.response.json [new file with mode: 0644]
api/pageplace.bosh-bosh-rest-cover.rst [new file with mode: 0644]
api/pageplace.bosh-bosh-rest-upload.response.json [new file with mode: 0644]
api/pageplace.bosh-bosh-rest-upload.rst [new file with mode: 0644]
api/thalia-auth-oauth2-token-post.rst
api/usecase-upload.rst [new file with mode: 0644]

index f7c99b83ede9f29cde41aa22ef6ac665e971301f..edd62806bfb2cb8d4d593d082ca246da238bc067 100644 (file)
@@ -20,10 +20,14 @@ Use cases
 *********
 .. include:: api/usecase-login.rst
 .. include:: api/usecase-sync.rst
+.. include:: api/usecase-upload.rst
 
 
 API calls
 *********
+.. include:: api/pageplace.bosh-bosh-rest-content-delete.rst
+.. include:: api/pageplace.bosh-bosh-rest-cover.rst
+.. include:: api/pageplace.bosh-bosh-rest-cover-xxx-yyy.rst
 .. include:: api/pageplace.bosh-bosh-rest-dictionary-list.rst
 .. include:: api/pageplace.bosh-bosh-rest-handshake-resellers.rst
 .. include:: api/pageplace.bosh-bosh-rest-inventory-count.rst
@@ -31,6 +35,7 @@ API calls
 .. include:: api/pageplace.bosh-bosh-rest-recommendation-xyz.rst
 .. include:: api/pageplace.bosh-bosh-rest-sync-data.rst
 .. include:: api/pageplace.bosh-bosh-rest-time.rst
+.. include:: api/pageplace.bosh-bosh-rest-upload.rst
 .. include:: api/pageplace.bosh-bosh-rest-userid-xxx.rst
 .. include:: api/pageplace.bosh-bosh-rest-v2-registerhw.rst
 .. include:: api/pageplace.bosh-bosh-rest-v2-resellerconfig.rst
diff --git a/api/pageplace.bosh-bosh-rest-content-delete.request.json b/api/pageplace.bosh-bosh-rest-content-delete.request.json
new file mode 100644 (file)
index 0000000..74fef29
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "contentDeleteRequest": {
+    "deleteAll": true,
+    "content": [
+      {
+        "deliverableId": "bosh_3_395490135492823841139311838"
+      }
+    ]
+  }
+}
diff --git a/api/pageplace.bosh-bosh-rest-content-delete.rst b/api/pageplace.bosh-bosh-rest-content-delete.rst
new file mode 100644 (file)
index 0000000..c3239ff
--- /dev/null
@@ -0,0 +1,20 @@
+===========================================================
+``POST https://bosh.pageplace.de/bosh/rest/content/delete``
+===========================================================
+Delete a book from the cloud.
+
+
+Request
+=======
+
+Example:
+
+.. include:: pageplace.bosh-bosh-rest-content-delete.request.json
+   :code:
+
+
+Response
+========
+HTTP status code: ``200 OK``.
+
+No content.
diff --git a/api/pageplace.bosh-bosh-rest-cover-xxx-yyy.rst b/api/pageplace.bosh-bosh-rest-cover-xxx-yyy.rst
new file mode 100644 (file)
index 0000000..0056849
--- /dev/null
@@ -0,0 +1,46 @@
+=========================================================
+``GET https://bosh.pageplace.de/bosh/rest/cover/xxx/yyy``
+=========================================================
+Fetch the cover for a manually uploaded book.
+
+Part of the `upload process`_.
+
+Request
+=======
+Only three headers. Unusual.
+
+Full URL example: ``https://bosh.pageplace.de/bosh/rest/cover/39549013/bosh_3_395490135492823841139311838?size=WS-B04``
+
+URL path parts
+  ``xxx``
+    8 bytes of the publication ID
+
+    Example: ``39549013``
+  ``yyy``
+    Publication ID
+
+    Example: ``bosh_3_395490135492823841139311838``
+Header
+  ``m_id``
+    Maybe reseller ID?
+
+    Example: ``3``
+  ``Host``
+    ``bosh.pageplace.de``
+  ``Connection``
+    ``Keep-Alive``
+
+GET parameters
+  ``size``
+    Image size (so we get a scaled version)
+
+    Known values:
+
+    - ``WS-B04``
+
+
+Response
+========
+HTTP status code: ``200 OK``.
+
+Binary cover image data.
diff --git a/api/pageplace.bosh-bosh-rest-cover.response.json b/api/pageplace.bosh-bosh-rest-cover.response.json
new file mode 100644 (file)
index 0000000..ff1559a
--- /dev/null
@@ -0,0 +1,8 @@
+{
+    "ResponseInfo": {
+        "message": "Cover uploaded successfully.",
+        "requestId": "41d3243f-6d7a-489a-8d98-b3f7f55cb794",
+        "responseStatus": 317,
+        "serviceName": "cover[POST]"
+    }
+}
diff --git a/api/pageplace.bosh-bosh-rest-cover.rst b/api/pageplace.bosh-bosh-rest-cover.rst
new file mode 100644 (file)
index 0000000..8811a0b
--- /dev/null
@@ -0,0 +1,47 @@
+==================================================
+``POST https://bosh.pageplace.de/bosh/rest/cover``
+==================================================
+Upload the cover for an uploaded ``.epub`` file.
+
+Step 2 of the `upload process`_.
+
+Request
+=======
+Header
+  ``Content-Type``
+    ``multipart/form-data; boundary="Boundary1612163626238"``
+
+Request body
+  Control data
+    Header
+      ``Content-Disposition: form-data; name="control"``
+    Content
+      JSON
+      ``{"filesize":334499,"transactionId":"84401550-d933-4f12-b168-87421835bada"}``
+
+      The transaction ID is different than the one for the epub upload.
+  File data
+    Header
+      ``Content-Disposition: form-data; name="file"; filename="1092560016"``
+    Content
+      Binary cover image contents
+  Book reference
+    Header
+      ``Content-Disposition: form-data; name="deliverableId"``
+    Content
+      ``deliverableId`` of the epub upload response.
+
+      Example: ``bosh_3_395490135492823841139311838``
+
+
+
+Response
+========
+HTTP status code: ``200 OK``.
+
+Meta data entry for the uploaded cover.
+
+Example:
+
+.. include:: pageplace.bosh-bosh-rest-cover.response.json
+   :code:
diff --git a/api/pageplace.bosh-bosh-rest-upload.response.json b/api/pageplace.bosh-bosh-rest-upload.response.json
new file mode 100644 (file)
index 0000000..841ad04
--- /dev/null
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "deliverableId": "bosh_3_395490135492823841139311838",
+    "title": "MacBest",
+    "subtitle": null,
+    "author": "Terry Pratchett",
+    "publisher": "Heyne",
+    "isbn": null,
+    "edition": null,
+    "pages": 0,
+    "issued": 0,
+    "language": "de",
+    "format": "application/epub+zip",
+    "epubVersion": "2.0"
+  }
+}
diff --git a/api/pageplace.bosh-bosh-rest-upload.rst b/api/pageplace.bosh-bosh-rest-upload.rst
new file mode 100644 (file)
index 0000000..0fe1155
--- /dev/null
@@ -0,0 +1,40 @@
+===================================================
+``POST https://bosh.pageplace.de/bosh/rest/upload``
+===================================================
+Upload a new book ``.epub`` file.
+
+Step 1 of the `upload process`_.
+
+
+Request
+=======
+Header
+  FIXME: Headers
+
+  ``Content-Type``
+    ``multipart/form-data; boundary="Boundary1612163626238"``
+
+Request body
+  Control data
+    Header
+      ``Content-Disposition: form-data; name="control"``
+    Content
+      JSON
+      ``{"filesize":334499,"transactionId":"84401550-d933-4f12-b168-87421835bada"}``
+  File data
+    Header
+      ``Content-Disposition: form-data; name="file"; filename="MacBest by Pratchett Terry.epub"``
+    Content
+      Binary .epub file contents
+
+
+Response
+========
+HTTP status code: ``200 OK``.
+
+Meta data entry for the uploaded file.
+
+Example:
+
+.. include:: pageplace.bosh-bosh-rest-upload.response.json
+   :code:
index 55189a9d3466595fed37042bd0adc26622ea1531..dec2099bb4963e120afc3cd7943b49c22d8b0386 100644 (file)
@@ -23,11 +23,13 @@ Headers
   ``User-Agent``
     ``DT_EINK_10_NETRONIX DT_EINK_UPD_PP_14.1.0``
   ``Cookie``:
+    The ``refresh_token`` request sends no cookie.
+
     Example: ``gcor=SIDYBbxYkmvUvoO8hy@2Sfx4QAAA9o; ab_bucket=9; ab_container=3; OAUTH-JSESSIONID=9C95C20ECEE74164E76F60C205147822.15acdb90``
   ``Cookie2``
     ``$Version=1``
 
-POST parameters
+POST parameters: New token
   ``grant_type``:
     ``authorization_code``
   ``redirect_uri``
@@ -41,6 +43,17 @@ POST parameters
   ``client_id``
     Example: ``treadervision3``
 
+POST parameters: Refresh token
+  ``grant_type``
+    ``refresh_token``
+  ``refresh_token``
+    Obtained in the last OAuth token response.
+
+    Example: ``91132a11-dd87-4450-bf16-a63dff1da4d1``
+  ``client_id``
+    Example: ``treadervision3``
+
+
 
 Response
 ========
diff --git a/api/usecase-upload.rst b/api/usecase-upload.rst
new file mode 100644 (file)
index 0000000..abd49c7
--- /dev/null
@@ -0,0 +1,14 @@
+==============
+Upload process
+==============
+The user wants to upload a book on the reader to the cloud.
+
+1. Upload the epub file: `POST https://bosh.pageplace.de/bosh/rest/upload`_
+2. Upload the cover image: `POST https://bosh.pageplace.de/bosh/rest/cover`_
+3. Fetch the number of books in the cloud: `GET https://bosh.pageplace.de/bosh/rest/inventory/count`_
+4. Fetch the current date/time: `GET https://bosh.pageplace.de/bosh/rest/time`_
+5. Fetch changes since last sync: `PATCH https://bosh.pageplace.de/bosh/rest/sync-data`_
+
+Some time later:
+
+6. Download the cover of the uploaded book: `GET https://bosh.pageplace.de/bosh/rest/cover/xxx/yyy`_