Ga naar hoofdinhoud

File Actions

Standards

  • GEMMA Documentbeheercomponent -- Dutch government document management standard
  • WebDAV (RFC 4918) -- Advisory locking semantics for concurrent file editing

Overview

Extended file operations for register objects beyond basic CRUD. Provides versioning, advisory locking with TTL, batch operations, thumbnail preview generation, download auditing, and label management. All file action endpoints operate under an object context (/api/objects/{register}/{schema}/{id}/files/...).

Key Capabilities

  • Rename / Copy / Move -- Rename a file in place, copy to a new object or location, or move between objects. Each operation preserves audit trail entries.
  • Version Management -- List all versions of a file (listVersions) and restore a previous version (restoreVersion). Built on Nextcloud's file versioning backend.
  • Advisory Locking with TTL -- Lock a file to signal editing intent. Locks are advisory (not enforced at filesystem level) and expire after a configurable TTL. Unlock explicitly or let TTL expire.
  • Batch Operations -- Perform publish, depublish, or delete on multiple files in a single request. Returns HTTP 207 Multi-Status with per-file results.
  • Thumbnail Preview -- Generate and serve thumbnail previews for supported file types. Returns a stream response for direct embedding.
  • Download Audit -- All file downloads (via downloadById) are tracked for compliance and audit trail purposes.
  • Label Management -- Attach, update, or remove classification labels on files (updateLabels). Supports arbitrary key-value label sets.

API Endpoints

All endpoints are scoped under /api/objects/{register}/{schema}/{id}/files unless otherwise noted.

MethodURLControllerDescriptionRoute Registered
GET.../filesfiles#indexList files for an objectYes
GET.../files/{fileId}files#showGet single file metadataYes
POST.../filesfiles#createUpload file (JSON body)Yes
POST.../files/savefiles#saveSave file contentYes
POST.../filesMultipartfiles#createMultipartUpload via multipart formYes
PUT.../files/{fileId}files#updateUpdate file metadataYes
DELETE.../files/{fileId}files#deleteDelete a fileYes
POST.../files/{fileId}/publishfiles#publishPublish a fileYes
POST.../files/{fileId}/depublishfiles#depublishDepublish a fileYes
GET/api/files/{fileId}/downloadfiles#downloadByIdDownload file by IDYes
GET.../files/downloadobjects#downloadFilesDownload all files as ZIPYes
POST.../files/{fileId}/renamefiles#renameRename a fileNo (method only)
POST.../files/{fileId}/copyfiles#copyCopy a fileNo (method only)
POST.../files/{fileId}/movefiles#moveMove a fileNo (method only)
GET.../files/{fileId}/versionsfiles#listVersionsList file versionsNo (method only)
POST.../files/{fileId}/versions/restorefiles#restoreVersionRestore a file versionNo (method only)
POST.../files/{fileId}/lockfiles#lockLock a file (advisory)No (method only)
POST.../files/{fileId}/unlockfiles#unlockUnlock a fileNo (method only)
POST.../files/batchfiles#batchBatch publish/depublish/deleteNo (method only)
GET.../files/{fileId}/previewfiles#previewGet file thumbnail previewNo (method only)
PUT.../files/{fileId}/labelsfiles#updateLabelsUpdate file labelsNo (method only)

Implementation Status

  • Registered routes (11): Core CRUD, publish/depublish, download, and multipart upload are fully routed.
  • Unregistered methods (10): Rename, copy, move, versioning, file-level locking, batch, preview, and labels exist as controller methods in FilesController but lack route definitions in appinfo/routes.php. These methods are implemented but not yet accessible via HTTP.
  • Object-level locking: Separate from file-level locking; object lock/unlock routes exist at /api/objects/{register}/{schema}/{id}/lock and /unlock via ObjectsController.
  • /lib/Controller/FilesController.php -- All file action controller methods
  • /appinfo/routes.php -- Route definitions (lines 305-318)