-
Notifications
You must be signed in to change notification settings - Fork 58
Test Frontend API
The Test Frontend is split into two parts:
- A server part written in Go, which act as a middleware between a user interface and the License Server.
- A client part written in Typescript and React, which is a pure user interface.
The Test Frontend Server exposes a set of REST methods which are used by the client part, but may also be used by any other REST client:
- Create, update, list and delete users.
- Create, update, list and delete encrypted publications.
- Let a user acquire a publication.
- Let a user generate and fetch a license.
- Fetch an up-to-date license by its identifier.
Some of these REST API endpoints are not documented; they'll be if needed.
For each publication, the frontend stores:
- Identifier
- Title
For each user, the frontend stores:
- Identifier
- Name
- Hash of the passphrase
GET <FrontBaseURL>/api/v1/licenses/<license_id>
Return:
- 200 + {license} (json): ok
- 404 (not found) This license does not exist in the database (type http://readium.org/license-status-document/error/notfound)
- 5xx: internal error (type http://readium.org/license-status-document/error/server)
This method calls the License Server with a request for an existing license.
POST <FrontBaseURL>/publicationUpload
Query Parameter:
title: the title of the publication. This title should no already exist in the database.
Payload: A multipart message, with a unique key named "file" and a binary value which is the content of the un-encrypted publication.
An equivalent curl command is of the form:
curl --location --request POST 'http://<server>/publicationUpload?title=<publication-title>'
--form 'file=@/<path>/<file-name.epub>'
Return:
- 200 ok
- 400 (bad request)
This method encrypts the publication and notifies the License Server, which stores the encrypted publication in its final storage location.