Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.

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="<group>",flags:{executable:<true> or <false>,readable:<true> or <false>,writable:<true> or <false>}}' 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/groups'

Verification

Check through a REST command or in the File Browser.

Change the Group Permission for a File

Request method - PUT

Description

Changes permissions for groups created in Datameer.

URI syntax

curl -u '<username>:<password>' -X PUT -H 'Content-Type:application/json' -d '{name="<group>",flags:{executable:<false> or <true>,readable:<false> or <true>,writable:<false> or <true>}}' 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/groups/<group>'

Verification

Check through a REST command or in the File Browser.

Change the Others Permissions for a File

Request method - PUT

Description

Changes permissions for others in Datameer.

URI syntax

curl -u '<username>:<password>' -X PUT -H 'Content-Type:application/json' -d '{executable:<false> or <true>,readable:<false> or <true>,writable:<false> or <true>}' 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/others'

Verification

Check through a REST command or in the File Browser.

Delete Group Permission of a File

Request method - DELETE

Description

Deletes the group permissions of a file in Datameer.

URI syntax

curl -u '<username>:<password>' -X DELETE -H 'Content-Type:application/json' 'http://<Datameer-serverIP>:<port-number>/api/filesystem/files/<file-id> or <uuid>/permission/groups/<group>'

Verification

Check through a REST command or in the File Browser.

  • No labels