Files
fm_be/docs/file-manager-get.md
2026-07-16 22:16:45 +07:00

231 lines
4.9 KiB
Markdown

# File Manager - GET Data (Step by Step)
# Daftar Endpoint
## Ringkasan Endpoint Utama
1. `GET /file-manager/get-all` untuk explorer merged (root/child)
2. `GET /file-manager/trash/get-all` untuk trash merged
3. `GET /file-manager/files/get/:uuid` untuk detail file
4. `GET /file-manager/folders/get/:uuid` untuk detail folder
## Endpoint Removed (tidak tersedia lagi)
1. `GET /file-manager/files/get-all`
2. `GET /file-manager/folders/get-all`
3. `GET /file-manager/files/get-all-trash`
4. `GET /file-manager/folders/get-all-trash`
## Step 1 - Ambil Explorer Root
### Endpoint
- `GET /api/v1/file-manager/get-all`
### Tujuan
- menampilkan isi root explorer (merged folder + file).
### Contoh response
```json
{
"data": [
{
"type": "file_manager_node",
"id": "folder-uuid",
"attributes": {
"node_type": "folder",
"name": "Documents",
"status": "ready",
"path_cache": "/Documents",
"created_at": "2026-03-31T08:52:03Z",
"updated_at": "2026-03-31T08:52:03Z"
}
},
{
"type": "file_manager_node",
"id": "file-uuid",
"attributes": {
"node_type": "file",
"name": "LOGO.png",
"extension": "png",
"size_bytes": 100988,
"mime_type": "image/png",
"download_url": "https://...",
"status": "ready",
"created_at": "2026-03-31T09:30:31Z",
"updated_at": "2026-03-31T09:30:31Z"
}
}
],
"meta": {
"is_root": true,
"folders": 1,
"files": 1,
"total": 2
}
}
```
## Step 2 - Buka Isi Folder
### Endpoint
- `GET /api/v1/file-manager/get-all?parent_uuid=<folder_uuid>`
### Tujuan
- menampilkan child langsung dari folder yang dipilih.
### Contoh response
```json
{
"data": [
{
"type": "file_manager_node",
"id": "inside-file-uuid",
"attributes": {
"node_type": "file",
"parent_id": "folder-uuid",
"name": "inside-folder.png",
"extension": "png",
"size_bytes": 42170,
"mime_type": "image/png",
"download_url": "https://...",
"status": "ready",
"created_at": "2026-04-05T07:29:33Z",
"updated_at": "2026-04-05T07:33:44Z"
}
}
],
"meta": {
"is_root": false,
"parent_uuid": "folder-uuid",
"breadcrumb": [
{
"id": "folder-uuid-level-1",
"name": "Documents"
},
{
"id": "folder-uuid",
"name": "Project A"
}
],
"folders": 0,
"files": 1,
"total": 1
}
}
```
## Step 2b - Ambil Data Trash (Merged)
### Endpoint
- `GET /api/v1/file-manager/trash/get-all`
### Tujuan
- menampilkan daftar node yang sedang trashed (folder + file).
### Contoh response
```json
{
"data": [
{
"type": "file_manager_trash_node",
"id": "folder-uuid",
"attributes": {
"node_type": "folder",
"name": "Documents",
"path_cache": "/Documents",
"trashed_at": "2026-04-01T10:00:00Z"
}
},
{
"type": "file_manager_trash_node",
"id": "file-uuid",
"attributes": {
"node_type": "file",
"name": "logo.png",
"extension": "png",
"size_bytes": 42170,
"mime_type": "image/png",
"download_url": "https://...",
"trashed_at": "2026-04-01T10:00:00Z"
}
}
],
"meta": {
"total": 2
}
}
```
## Step 3 - Ambil Detail File
### Endpoint
- `GET /api/v1/file-manager/files/get/:uuid`
### Tujuan
- ambil detail information dari satu file untuk panel/detail page.
### Contoh response
```json
{
"data": {
"type": "file_manager_file",
"id": "file-uuid",
"attributes": {
"name": "spidey.png",
"name_normalized": "spidey.png",
"extension": "png",
"size_bytes": 42170,
"mime_type": "image/png",
"download_url": "https://...",
"status": "ready",
"location": {
"folder_id": "folder-uuid"
},
"processing": {
"processing_started_at": "2026-04-05T07:29:34Z",
"processed_at": "2026-04-05T07:29:34Z",
"validated_at": "2026-04-05T07:29:34Z"
},
"audit": {
"created_at": "2026-04-05T07:29:33Z",
"created_by": "019d194e-f595-7d5f-a5bf-3609231ba43d",
"updated_at": "2026-04-05T07:33:44Z",
"updated_by": "019d194e-f595-7d5f-a5bf-3609231ba43d"
}
}
}
}
```
## Step 4 - Ambil Detail Folder
### Endpoint
- `GET /api/v1/file-manager/folders/get/:uuid`
### Tujuan
- ambil detail satu folder (mis. untuk panel detail folder/breadcrumb context).
### Contoh response
```json
{
"data": {
"type": "file_manager_folder",
"id": "folder-uuid",
"attributes": {
"name": "Documents",
"name_normalized": "documents",
"path_cache": "/Documents",
"audit": {
"created_at": "2026-03-31T08:52:03Z",
"created_by": "019d194e-f595-7d5f-a5bf-3609231ba43d",
"updated_at": "2026-03-31T08:52:03Z",
"updated_by": "019d194e-f595-7d5f-a5bf-3609231ba43d"
}
}
}
}
```