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 Definition

Alias

filemanagerFile

Relations

Relation
Key
Type
Relation Field(s)

user

Belongs to

user_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.

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

Show

Show 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

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/filemanager/files', [
    'headers' => ['Authorization' => "Bearer {$accessToken}"],
    'multipart' => [
        [
            'name' => 'file',
            'contents' => fopen('/path/to/file/Lorem ipsum.pdf', 'r')
        ],
        [
            'name' => 'path',
            'contents' => 'Lorem ipsum.pdf'
        ]
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "path": "/Lorem ipsum.pdf",
    "extension": "pdf",
    "mime_type": "application/pdf",
    "size": 13997,
    "created_at": "2020-02-12 10:58:12",
    "updated_at": "2020-02-12 10:58:12",
    "hash": "zn7m24owk63qolxryge8pj05",
    "name": "Lorem ipsum.pdf",
    "url": "/api/files/4geewv9rjq6vt8ovz6r8jppv/Lorem ipsum.pdf"
  }
}

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

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/filemanager/files/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'path' => 'Dolor sit amet/Lorem ipsum.pdf'
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "path": "/Dolor sit amet/Lorem ipsum.pdf",
    "extension": "pdf",
    "mime_type": "application/pdf",
    "size": 13997,
    "created_at": "2020-02-12 10:58:12",
    "updated_at": "2020-02-12 11:10:17",
    "hash": "zn7m24owk63qolxryge8pj05",
    "name": "Lorem ipsum.pdf",
    "url": "/api/files/2yqqxnoe82dnivng6jevz44gcj8j8ry8kkv4i57yrxeonrjjt0dve4g/Lorem ipsum.pdf"
  }
}

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