diff options
author | Katharina Fey <kookie@spacekookie.de> | 2018-06-10 01:41:03 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2018-06-10 01:41:03 +0200 |
commit | d58613517e9bf66dc52cc6f2e983974f2ceb91f7 (patch) | |
tree | a667f5204e0038817454d2e0912cd063badf7ad7 | |
parent | 31e837e28677dfc86e029b211e51d636bf3fc659 (diff) |
Adding documentation for the REST API (to be)
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | lockchain-http/README.md | 72 | ||||
-rw-r--r-- | lockchain-server/src/main.rs | 14 |
3 files changed, 81 insertions, 9 deletions
@@ -837,7 +837,7 @@ dependencies = [ [[package]] name = "lockchain-http" -version = "0.2.0" +version = "0.2.1" dependencies = [ "actix 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -856,7 +856,7 @@ dependencies = [ "insult 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lockchain-core 0.7.2", "lockchain-files 0.7.1", - "lockchain-http 0.2.0", + "lockchain-http 0.2.1", ] [[package]] diff --git a/lockchain-http/README.md b/lockchain-http/README.md index 217185d..bfeb79f 100644 --- a/lockchain-http/README.md +++ b/lockchain-http/README.md @@ -5,16 +5,86 @@ A plug and play http interface layer for various lockchain components. ## API Reference -This document will move +This document will move. + +All JSON payloads also include an `error` field that is set in case of errors, if no other data is set. + +```json +{ + error: ["Prose error description", 5 /* error code*/ ], + data: { + /* Whatever the data is – depending on endpoint */ + } +} +``` + +#### GET /api + +Get information about this API endpoint. Information is received in JSON format and include the following fields. + +`verison`: The API version +`providers`: An array with type providers. This includes the Vault and Body implementation specifics. +`hostname`: Optional value which specifies the server name + +#### GET /vault + +Get a list of vaults known to this system, possibly only returning a single value + +`vaults`: List of vault names that are available to work with +`count`: The number of vaults available #### PUT /vault + +Create a new vault. Payloads + +`name`: The name of the vault +`location`: The location of a vault, left to the implementation specifics + #### POST /vault/{id} + +Update metadata about a vault that already exists. Will return an error if it doesn't + #### DELETE /vault/{id} +Delete a vault; a second transaction is required to confirm, after all users were logged-out + #### GET /vault/{vault id}/records/{record id} + +Get a specific record from a vault. Only available if authenticated + #### PUT /vault/{vault id}/records + +Add a new record to a vault. Only available if authenticated + #### POST /vault/{vault id}/records/{record id} + +Update data inside an existing record. Only available if authenticated + #### DELETE /vault/{vault id}/records/{record id} +Delete a record. Only available if authenticated + +#### GET /users + +Get a list of available users + +#### PUT /users + +Create a new user + +#### DELETE /users/{id} + +Delete a user. Only available if authenticated as THAT user. + +In the future, admin users (and priviledge hirarchies might be added) + #### PUT /authenticate + +Authenticate as a specific user + +`username`: The user to authenticate as +`password`: The user passphrase to use for authentication (different from the encryption passphrase) + #### PUT /de-authenticate + +Called to end an active session.
\ No newline at end of file diff --git a/lockchain-server/src/main.rs b/lockchain-server/src/main.rs index 25ba54d..8ffbaa1 100644 --- a/lockchain-server/src/main.rs +++ b/lockchain-server/src/main.rs @@ -1,12 +1,14 @@ -extern crate lockchain_core; -extern crate lockchain_files; -extern crate lockchain_http; +//! Core lockchain application server extern crate clap; -// use lockchain_core::{traits::*, EncryptedBody}; -// use lockchain_http::create_server; -// use lockchain_files::DataVault; +extern crate lockchain_core as core; +extern crate lockchain_files as files; +extern crate lockchain_http as http; + +// use core::{traits::*, EncryptedBody}; +// use files::DataVault; +// use http::create_server; fn main() { |