uvicorn sysapi.main:app --reload# SAFER-STORAGE System Backend REST API Server
This backend is implemented using FastAPI
Quick start
Install the module on your system sing PyPI:
pip install sysapi
Then start the service using default settings (test on localhost:8000), run the following command:
uvicorn sysapi.main:app --reload
File system organization
(download PDF)
REST Routes
GET routes
Version prefix
All routes start with a /{version}/ prefix, which is currently set to v1
Meta data
These routes are used to retrieve data about users and snapshots
/v1/users: list user accounts/v1/user/{user}: getuser's meta-data/v1/snapshots: list of all available snapshots/v1/snapshots?user={user}: list of available snapshots foruser/v1/snapshot/{@snapshot}: get@snapshotmeta-data
NB:
users,snapshots, androotare reserved user names to avoid conflicts.- snapshots are always identified using an
@-prefixed name, eg.@initial, which also solved ambiguity between snapshot and user routes.
Filesystem navigation in time and space
The general form is as follows:
/v1/{user}/{time-location}/{space-location}
With the following constructs:
{time-location}is one of:fat/{@sanpshot}: the state of a single file as captured in snapshot named{snapid}dat/{@sanpshot}: the state of a directory as captured in snapshot named{snapid}fbefore/{@snapshot}: the state of a file as captured in snapshot immediately preceding the snapshot named{@snapshot}(if any)dbefore/{@snapshot}: the state of a directory as captured in snapshot immediately preceding the snapshot named{@snapshot}(if any)past/{@snapshot}: merged view of a directory composed of all snapshot(s) preceding, and including, the snapshot named{@snapshot}.historic/{username}/{path}: list of snapshots that contain the given file for the given user- The special name
@currentis reserved and used to designate the current state of the filesystem. It is actually a real snapshot, that is created each time an API call requests this time-point.
{space-location}is of the form:- `` (empty):
user's homedir content {path}/: content of the directory designated by the URL-encodedpathstarting from theuser's homedir{path}/file: file located in directory designated bypath
- `` (empty):
NB: the root virtual user is only available to the admin user and his/her home directpry is at the root of the filesystem
Examples:
/v1/joe/at/@current/:joe's current homedir/v1/joe/at/@snap-2019-09-18-2230/Photos/Kickoff/people.jpg:joe's file namedpeople.jpgin sub-directoryPhotos/Kickoffas it was captured by snapshot named@snap-2019-09-18-2230/v1/root/before/@snap-2019-09-18-2230/users/joe/Photos/: content of directoryusers/joe/Photos/for admin user as it was captured by snapshot immediately preceding the snapshot named@snap-2019-09-18-2230
POST routes
-
/v1/users/newCreates a user with following elements:
- login
- password
-
/v1/copyto/{space-location}Copies the list of files designated in the body to the space-location designated by the URL: In the body, each file is designated by a triplet:
"path"="path/to/file""snapshot"="@snapshot"from which the file is copied"destructive"=booleanReturns: The updated content of target directory (space-location)
Release files for sysapi 0.0.53
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sysapi-0.0.53-py3-none-any.whl | Python 3 | none | any | Details |
Release files / sysapi-0.0.53-py3-none-any.whl
| Download URL | sysapi-0.0.53-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f38fe384fd062ed629758c1b704337faa861b7f02923877878a8ac628d58eaff
|
|
BLAKE2b-256 checksum How to use checksums |
8a221d797f2fe1a549c5ecfdf4b9f04533cf53236ea6f23183cd8d8259f039dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1
|