REST API Files
Unlike other REST APIs, these use the file ID (found in the Browser) or the UUID (found in all payloads or json representations) instead of the configuration ID.
The REST API for files follows the best practices for RESTful API design. Ensure you read the HTTP status codes and interpret them together with the responses.
- 1 Read a File
- 1.1 Description
- 1.2 URI syntax
- 1.3 Example response
- 2 Read the Permissions of a File
- 2.1 Description
- 2.2 URI syntax
- 2.3 Example response
- 3 Read the Group Permissions of a File
- 3.1 Description
- 3.2 URI syntax
- 3.3 Example response
- 4 Read the Others Permissions of a File
- 4.1 Description
- 4.2 URI syntax
- 4.3 Example response
- 5 Read the Owner of a File
- 5.1 Description
- 5.2 URI syntax
- 5.3 Example response
- 6 Change the Owner of a File
- 6.1 Description
- 6.2 URI syntax
- 6.3 Verification
- 7 Create a Group Permission for a File
- 7.1 Description
- 7.2 URI syntax
- 7.3 Verification
- 7.4 Additional Information
- 8 Change the Group Permission for a File
- 8.1 Description
- 8.2 URI syntax
- 8.3 Verification
- 8.4 Additional Information
- 9 Change the Others Permissions for a File
- 9.1 Description
- 9.2 URI syntax
- 9.3 Verification
- 9.4 Additional Information
- 10 Delete Group Permission of a File
- 10.1 Description
- 10.2 URI syntax
- 10.3 Verification
For each call, you can add the following command:
-w"\n%{http_code}\n"
After the username and password in order to receive more meaningful HTTP errors.
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 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'Verification
Check through a REST command or in the File Browser.
Create a Group Permission for a File
Request method - POST
Description
Sets permissions for groups created in Datameer.
URI syntax
curl -u <username>:<password> -X POST -H 'Content-Type:application/json' -d '{name:<groupName>, flags:{fullResults:<true/false>, readable:<true/false>, writable:<true/false>, executable:<true/false> }}' 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/groups'