# lockchain-http
A plug and play http interface layer for various lockchain components.
## API Reference
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
- `supported`: A list of supported client/ API combinations, writtin in tuple form. These are auto-generated by the API provider
#### GET /{api version}/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 /{api version}/vault
Create a new vault. Payloads
- `name`: The name of the vault
- `location`: The location of a vault, left to the implementation specifics
#### POST /{api version}/vault/{id}
Update metadata about a vault that already exists. Will return an error if it doesn't
#### DELETE /{api version}/vault/{id}
Delete a vault; a second transaction is required to confirm, after all users were logged-out
#### GET /{api version}/vault/{vault id}/records/{record id}
Get a specific record from a vault. Only available if authenticated
#### PUT /{api version}/vault/{vault id}/records
Add a new record to a vault. Only available if authenticated
#### POST /{api version}/vault/{vault id}/records/{record id}
Update data inside an existing record. Only available if authenticated
#### DELETE /{api version}/vault/{vault id}/records/{record id}
Delete a record. Only available if authenticated
#### GET /{api version}/users
Get a list of available users
#### PUT /{api version}/users
Create a new user
#### DELETE /{api version}/users/{id}
Delete a user. Only available if authenticated as THAT user.
In the future, admin users (and priviledge hirarchies might be added)
#### PUT /{api version}/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 /{api version}/de-authenticate
Called to end an active session.