sfss.api.endpoint
v0.0.2
Published
Simple FS Storage Service enable a node app to store/retieve JSON objects to/from the filesystem via HTTP
Downloads
14
Maintainers
Readme
Simple FS Storage API Endpoint
Builds uppon sfss.lib the Simple FS Storage library.
##Usage
Options
dataRoot (mandatory)
: {String} absolut path to the root directory of the store.disableFileDeletion
: {Boolean} makes sure that no file can be deleted.disableDirectoryDeletion
: {Boolean} makes sure that no directory can be deleted.
API
PUT api_root
/sfss/tree[/path]
Creates a new directory (success Status Code 201):
{
"data": {
"ref": "/sfss/tree/trial",
"action": "created"
},
"status": "success"
}
GET api_root
/sfss/tree[/path]
Returns the directory content - files and subdirectories names as Array (success Status Code 200):
{
"ref": "/sfss/tree/test",
"type": "directoryContent",
"data": [
"first.json",
"second.json",
"sub"
],
"status": "success"
}
DELETE api_root
/sfss/tree[/path]
Deep deletion of the directory, like rm -rf
(success Status Code 204): no body
PUT api_root
/sfss/data[/path]/filename.json
Creates or updates a file (success Status Code 201):
{
"ref": "/sfss/data/test/first.json",
"data": {
"fileId": 1
},
"status": "success"
}
GET api_root
/sfss/data[/path]
Reads all files in the directory (bulk read) (success Status Code 200):
{
"ref": "/sfss/data/test",
"type": "multipleFileContent",
"data": [
{
"fileId": 1
},
{
"fileId": 2
}
],
"status": "success"
}
GET api_root
/sfss/data[/path]/filename.json
Reads a file (success Status Code 200):
{
"ref": "/sfss/data/test/first.json",
"type": "fileContent",
"data": {
"fileId": 1
},
"status": "success"
}
DELETE api_root
/sfss/data[/path]/filename.json
Removes a file (success Status Code 204): no body