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
api_root
/sfss/tree[/path]
PUT Creates a new directory (success Status Code 201):
{
"data": {
"ref": "/sfss/tree/trial",
"action": "created"
},
"status": "success"
}
api_root
/sfss/tree[/path]
GET 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"
}
api_root
/sfss/tree[/path]
DELETE Deep deletion of the directory, like rm -rf
(success Status Code 204): no body
api_root
/sfss/data[/path]/filename.json
PUT Creates or updates a file (success Status Code 201):
{
"ref": "/sfss/data/test/first.json",
"data": {
"fileId": 1
},
"status": "success"
}
api_root
/sfss/data[/path]
GET 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"
}
api_root
/sfss/data[/path]/filename.json
GET Reads a file (success Status Code 200):
{
"ref": "/sfss/data/test/first.json",
"type": "fileContent",
"data": {
"fileId": 1
},
"status": "success"
}
api_root
/sfss/data[/path]/filename.json
DELETE Removes a file (success Status Code 204): no body