REST API Files

REST API Files

INFO

Add the following command after the username and password to receive more meaningful HTTP errors:

-w"\n%{http_code}\n"

This command can be added to each call.

Read a File

Request Method

GET

Description

Returns a list of the file information in Datameer.

URI Syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>'

Example Response

{ "createdAt": "2016-01-21T15:45:58.487+01:00", "description": "", "extension": "upl", "folder": [ "/Data/FileUploads", "b618b856-ec00-436e-afd3-3cbe65c8175a" ], "modifiedAt": "2016-01-21T15:46:55.280+01:00", "name": "TestCase", "path": "/Data/FileUploads/TestCase.upl", "permission": { "groups": {}, "owner": "admin", "permissionForOthers": { "executable": false, "readable": false, "writable": false }, "publiclyShared": false }, "uuid": "816ab399-7aae-424f-9f60-a9265cebc9a8", "_links": { "folder": { "href": "/api/filesystem/folders/8" }, "self": { "href": "/api/filesystem/files/50" }, "permission": { "href": "/api/filesystem/files/50/permission" } }

Read the Permissions of a File

Request Method

GET

Description

Returns a list of the file permissions in Datameer.

URI Syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission'

Example Response

{ "others": { "executable": true, "readable": true, "writable": true }, "owner": "system", "_links": { "others": { "href": "/api/filesystem/files/26/permission/others" }, "file": { "href": "/api/filesystem/files/26" }, "owner": { "href": "/api/filesystem/files/26/permission/owner" }, "self": { "href": "/api/filesystem/files/26/permission" }, "groups": { "href": "/api/filesystem/files/26/permission/groups" } }

Read the Group Permissions of a File

Request Method

GET

Description

Returns a list of the file group permissions in Datameer.

URI Syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/groups'

Example Response

{ "_links": { "self": { "href": "/api/filesystem/files/26/permission/groups" }, "permission": { "href": "/api/filesystem/files/26/permission" } }, "_embedded": { "groups": [ { "flags": { "executable": true, "readable": true, "writable": true }, "name": "dasuser", "_links": { "self": { "href": "/api/filesystem/files/26/permission/groups/dasuser" }, "permission": { "href": "/api/filesystem/files/26/permission" } } } ] }

Read the Others Permissions of a File

Request Method

GET

Description

Returns a list of the file permissions for others in Datameer.

URI Syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/others'

Example Response

{ "executable": true, "readable": true, "writable": true, "_links": { "self": { "href": "/api/filesystem/files/26/permission/others" }, "permission": { "href": "/api/filesystem/files/26/permission" } }

Read the Owner of a File

Request Method

GET

Description

Returns the owner of file in Datameer.

URI Syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/owner'

Example Response

{ "owner": "system", "_links": { "self": { "href": "/api/filesystem/files/26/permission/owner" }, "permission": { "href": "/api/filesystem/files/26/permission" } }

Change the Owner of a File

Request Method

PUT

Description

Changes the owner of a file in Datameer.

URI Syntax

curl -u <username>:<password> -X PUT -H 'Content-Type:application/json' -H 'Accept: application/json' -d "{owner:<username>}" 'http:// <Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/owner'