From: Christian Weiske Date: Sun, 7 Mar 2021 20:07:08 +0000 (+0100) Subject: Work in progress #5: Uploading and deleting own ebooks X-Git-Url: https://git.cweiske.de/tolino-api-docs.git/commitdiff_plain/ae22e1f9c62160fc060cc268e22ecb9ba6016ca5?hp=a55bb2fe42a4b01386566c9000fed8642fc6c071 Work in progress #5: Uploading and deleting own ebooks --- diff --git a/README.rst b/README.rst index f7c99b8..edd6280 100644 --- a/README.rst +++ b/README.rst @@ -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 index 0000000..74fef29 --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-content-delete.request.json @@ -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 index 0000000..c3239ff --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-content-delete.rst @@ -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 index 0000000..0056849 --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-cover-xxx-yyy.rst @@ -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 index 0000000..ff1559a --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-cover.response.json @@ -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 index 0000000..8811a0b --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-cover.rst @@ -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 index 0000000..841ad04 --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-upload.response.json @@ -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 index 0000000..0fe1155 --- /dev/null +++ b/api/pageplace.bosh-bosh-rest-upload.rst @@ -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: diff --git a/api/thalia-auth-oauth2-token-post.rst b/api/thalia-auth-oauth2-token-post.rst index 55189a9..dec2099 100644 --- a/api/thalia-auth-oauth2-token-post.rst +++ b/api/thalia-auth-oauth2-token-post.rst @@ -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 index 0000000..abd49c7 --- /dev/null +++ b/api/usecase-upload.rst @@ -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`_