Version: 0.9.1 (beta)
Supported client libraries: jQuery, AngularJS, Python
Service connector constructor. Takes all options to connect to the service.
Parameter
User.token()
to authenticate the user. Browser based applications
can also call User.signin()
to retrieve the token as cookie to be handled automatically by the browser.See Endpoints for API calls for all supported options.
var app = new nive.FileStore({name:"myapp"}); app.list({path:"/"}); // or nive.FileStore({name:'myapp'}).list({path:"/"});
Returns file or directory properties in json format.
Parameter
Returns
e.g.
{"name":"index.html", "type":"f",
"size":2312, "mime":"text/html", "cache": "",
"mtime":"2014/03/01 12:15:10", "ctime":"2014/03/01 11:15:10"}
Status codes
nive.FileStore({name:'myapp'}).getItem({path:'/index.html'}) .done(function (data, message, xhr) { // receive the result as data details = data; });
Prefix the method with '@' to avoid overlapping directory or file names GET http://mydomain.nive.io/myapp/index.html/@getItem => {"name":"index.html", "type":"f", "size":2312, "mime":"text/html"}
Create a new file or directory with the given path.
Parameter
Returns
Status codes
----
----
Update a file or directory with the given contents or meta information.
Parameter
Returns
Status codes
----
----
Delete a file or directory. If ‘path’ references a non empty directory ‘recursive’ must be set to true.
Parameter
Returns
Status codes
----
----
Read the files contents.
Parameter
Returns
Status codes
----
----
Update the files contents.
Parameter
Returns
Status codes
----
----
Move a file or folder to a new path.
Parameter
Returns
Status codes
----
----
Returns a detailed list of contained files and directories.
Parameter
Returns
Each item contains the following information:
e.g. [{"name":"index.html", "type":"f", "size":2312, "mime":"text/html", "mtime":"2014/03/01 12:15:10"}]
nive.FileStore({name:'myapp'}).list({path:'/myfolder', type:'all'}) .done(function (data, message, xhr) { // receive the result as data detailed_listing = data; });
Prefix the method with '@' to avoid overlapping directory or file names :: GET http://mydomain.nive.io/myapp/myfolder/@list => [ {"name":"subfolder", "type":"d", "size":0, "mime":""}, {"name":"index.html", "type":"f", "size":2312, "mime":"text/html"} ]
Checks whether or not the current user has the given permission(s).
Parameter
Return values
Status codes
nive.FileStore({name:'mystorage'}).allowed({permission:'list'}) .done(function (data, message, xhr) { if(!data.result) $('#message').text('You are not allowed to list items.'); });
POST http://mydomain.nive.io/mystorage/api/allowed Content-Type: application/json {"permission":"list"} => {"result": false, "list": false}
Note
Administration function!
Retrieve all permissions and assigned groups of this service. The result contains a list of permission and groups items.
[
{permission: "newItem", groups: ["sys:noone"]},
{permission: "setItem", groups: ["sys:everyone"]},
...
]
Return values
The function returns a permission:name, groups:list item for each permission. [{permission:name, groups:list}, ...]
Status codes
---
---
Note
Administration function!
Update a single or multiple service permissions. Each permission to be updated must include the name, one or multiple groups and a action: ‘add’ (default), ‘replace’, ‘revoke’.
[
{permission: "newItem", groups: ["sys:noone"], action: "replace"},
{permission: "setItem", groups: ["sys:everyone"], action: "revoke"},
...
]
Parameter
for each permission
Return values
Status codes
---
---
Retrieve the owner of a item referenced by key or id. This function returns a list of all matching items.
Parameter
Return values
Status codes
---
---
Change the owner of the given item.
Parameter
Return values
Status codes
---
---
Simple test and health check function.
Parameter
Return values
nive.FileStore().ping() .done(function (data, message, xhr) { $('#message').text('Seems alive!'); });
GET http://mydomain.nive.io/mystorage/api/ping Content-Type: application/json {"active": true} => {"result": 1}