FilemanagerFiles

Introduction

FileManagerFiles represent a File on the filesystem. FileManagerFiles will always attach an url to a File.

There is no direct relation to a FilemanagerDirectory. The resolution of files and directories is done by their path property.

A file can be saved on any path. If there are no FilemanagerDirectories added which represent the sections of the path, the according FilemanagerDirectories will be created.

Model & Relations

Namespace

Modules\Filemanager\Entities\FilemanagerFile

Relations

Relation Key Type Relation Field(s)
User user Belongs to user_id
FilemanagerFileSharedUrls shared_urls Has many filemanager_file_shared_urls.file_id

Computed Properties

  • hash - The hashed id of the FilemanagerFile
  • name - The basename of the FilemanagerFile
  • url - Encoded URL to the underlying file

Traits

  • SoftDeletes

List

Get a list of all FilemanagerFiles the current authenticated User is allowed to view.

Note

You can use the filters matches_path and matches_path_recursive on routes of this module. However, the response time of the list action can be considerably high because of recursive permission handling. You might want to use the list by path action for tasks regarding a specific path.

Definition

GET /api/filemanager/files

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/filemanager/files', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 1,
    "user_id": 3,
    "path": "/Lorem ipsum/Lorem Ipsum.pdf",
    "extension": "pdf",
    "mime_type": "application/pdf",
    "size": 87236,
    "created_at": "2018-12-20 13:58:15",
    "updated_at": "2018-12-21 15:55:10",
    "deleted_at": null,
    "hash": "zn7m24owk63qolxryge8pj05",
    "name": "Lorem Ipsum.pdf",
    "url": "/files/jjee2zq97k8ztpzy67xpreeysxzx00onx940bn884yqqdeow/Lorem Ipsum.pdf"
  },
  {
    "id": 2,
    "user_id": 3,
    "path": "/Lorem ipsum/Dolor sit amet.jpg",
    "extension": "jpg",
    "mime_type": "image/jpeg",
    "size": 187607,
    "created_at": "2018-12-20 13:58:19",
    "updated_at": "2018-12-21 15:55:18",
    "deleted_at": null,
    "hash": "6o8m0kz5yw10x1pr9e4vxj27",
    "name": "Dolor sit amet.jpg",
    "url": "/files/jjee2zq97k8ztpzy67xpreeysxzx00onx940bn884yqqdeow/Dolor sit amet.jpg"
  }
]

List by path

Get a list of all FilemanagerFiles by given {path} the current authenticated User is allowed to view.

If you don't pass a value for {path} a call to the root folder will be assumed.

Definition

GET /api/filemanager/files/path/{path}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/filemanager/files/path/Lorem%20ipsum', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 1,
    "user_id": 3,
    "path": "/Lorem ipsum/Lorem Ipsum.pdf",
    "extension": "pdf",
    "mime_type": "application/pdf",
    "size": 87236,
    "created_at": "2018-12-20 13:58:15",
    "updated_at": "2018-12-21 15:55:10",
    "deleted_at": null,
    "hash": "zn7m24owk63qolxryge8pj05",
    "name": "Lorem Ipsum.pdf",
    "url": "/files/jjee2zq97k8ztpzy67xpreeysxzx00onx940bn884yqqdeow/Lorem Ipsum.pdf"
  },
  {
    "id": 2,
    "user_id": 3,
    "path": "/Lorem ipsum/Dolor sit amet.jpg",
    "extension": "jpg",
    "mime_type": "image/jpeg",
    "size": 187607,
    "created_at": "2018-12-20 13:58:19",
    "updated_at": "2018-12-21 15:55:18",
    "deleted_at": null,
    "hash": "6o8m0kz5yw10x1pr9e4vxj27",
    "name": "Dolor sit amet.jpg",
    "url": "/files/jjee2zq97k8ztpzy67xpreeysxzx00onx940bn884yqqdeow/Dolor sit amet.jpg"
  }
]

Count

Get the count of all FilemanagerFiles the current authenticated User is allowed to view.

Definition

GET /api/filemanager/files/count

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/filemanager/files/count', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

5

Get

Get a single FilemanagerFile by id.

Definition

GET /api/filemanager/files/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/filemanager/files/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "id": 1,
  "user_id": 3,
  "path": "/Lorem ipsum/Lorem Ipsum.pdf",
  "extension": "pdf",
  "mime_type": "application/pdf",
  "size": 87236,
  "created_at": "2018-12-20 13:58:15",
  "updated_at": "2018-12-21 15:55:10",
  "deleted_at": null,
  "hash": "zn7m24owk63qolxryge8pj05",
  "name": "Lorem Ipsum.pdf",
  "url": "/files/jjee2zq97k8ztpzy67xpreeysxzx00onx940bn884yqqdeow/Lorem Ipsum.pdf"
}

Create

Create a new FilemanagerFile.

Definition

POST /api/filemanager/files

Request Keys

Key Type Default Description
file * file - The File to be uploaded
path * string - Relative path to the FilemanagerFile (normalized to include leading /)

Keys with * are required.

Example Request

Example Response


Update

Update an existing FilemanagerFile by id.

Definition

PUT /api/filemanager/files/{id}

Request Keys

Key Type Description
file file The File to be uploaded
path string Relative path to the FilemanagerFile (normalized to include leading /)

Example Request

Example Response


Delete

Delete an existing FilemanagerFile by id.

Definition

DELETE /api/filemanager/files/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/filemanager/files/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "status": "success",
  "data": null
}
Last Updated: 05/21/2019