{ "openapi": "3.0.3", "info": { "title": "files", "version": "0.0.1", "description": "File Management", "license": { "name": "agpl" } }, "components": { "securitySchemes": { "basic_auth": { "type": "http", "scheme": "basic" }, "bearer_auth": { "type": "http", "scheme": "bearer" } }, "schemas": { "Capabilities": { "type": "object", "required": [ "files" ], "properties": { "files": { "type": "object", "required": [ "$comment", "bigfilechunking", "blacklisted_files", "forbidden_filenames", "forbidden_filename_basenames", "forbidden_filename_characters", "forbidden_filename_extensions", "directEditing" ], "properties": { "$comment": { "type": "string", "nullable": true }, "bigfilechunking": { "type": "boolean" }, "blacklisted_files": { "type": "array", "items": { "type": "object" } }, "forbidden_filenames": { "type": "array", "items": { "type": "string" } }, "forbidden_filename_basenames": { "type": "array", "items": { "type": "string" } }, "forbidden_filename_characters": { "type": "array", "items": { "type": "string" } }, "forbidden_filename_extensions": { "type": "array", "items": { "type": "string" } }, "directEditing": { "type": "object", "required": [ "url", "etag", "supportsFileId" ], "properties": { "url": { "type": "string" }, "etag": { "type": "string" }, "supportsFileId": { "type": "boolean" } } } } } } }, "FolderTree": { "type": "array", "items": { "type": "object", "required": [ "id", "basename", "children" ], "properties": { "id": { "type": "integer", "format": "int64" }, "basename": { "type": "string" }, "displayName": { "type": "string" }, "children": { "type": "array", "items": { "type": "object" } } } } }, "OCSMeta": { "type": "object", "required": [ "status", "statuscode" ], "properties": { "status": { "type": "string" }, "statuscode": { "type": "integer" }, "message": { "type": "string" }, "totalitems": { "type": "string" }, "itemsperpage": { "type": "string" } } }, "TemplateField": { "type": "object", "required": [ "index", "content", "type" ], "properties": { "index": { "type": "string" }, "content": { "type": "string" }, "type": { "type": "string" } } }, "TemplateFile": { "type": "object", "required": [ "basename", "etag", "fileid", "filename", "lastmod", "mime", "size", "type", "hasPreview" ], "properties": { "basename": { "type": "string" }, "etag": { "type": "string" }, "fileid": { "type": "integer", "format": "int64" }, "filename": { "type": "string", "nullable": true }, "lastmod": { "type": "integer", "format": "int64" }, "mime": { "type": "string" }, "size": { "type": "integer", "format": "int64" }, "type": { "type": "string" }, "hasPreview": { "type": "boolean" } } }, "TemplateFileCreator": { "type": "object", "required": [ "app", "label", "extension", "iconClass", "iconSvgInline", "mimetypes", "ratio", "actionLabel" ], "properties": { "app": { "type": "string" }, "label": { "type": "string" }, "extension": { "type": "string" }, "iconClass": { "type": "string", "nullable": true }, "iconSvgInline": { "type": "string", "nullable": true }, "mimetypes": { "type": "array", "items": { "type": "string" } }, "ratio": { "type": "number", "format": "double", "nullable": true }, "actionLabel": { "type": "string" } } } } }, "paths": { "/index.php/apps/files/api/v1/thumbnail/{x}/{y}/{file}": { "get": { "operationId": "api-get-thumbnail", "summary": "Gets a thumbnail of the specified file", "tags": [ "api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "x", "in": "path", "description": "Width of the thumbnail", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "y", "in": "path", "description": "Height of the thumbnail", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "file", "in": "path", "description": "URL-encoded filename", "required": true, "schema": { "type": "string", "pattern": "^.+$" } } ], "responses": { "200": { "description": "Thumbnail returned", "content": { "*/*": { "schema": { "type": "string", "format": "binary" } } } }, "400": { "description": "Getting thumbnail is not possible", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "404": { "description": "File not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/directEditing": { "get": { "operationId": "direct_editing-info", "summary": "Get the direct editing capabilities", "tags": [ "direct_editing" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Direct editing capabilities returned", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "editors", "creators" ], "properties": { "editors": { "type": "object", "additionalProperties": { "type": "object", "required": [ "id", "name", "mimetypes", "optionalMimetypes", "secure" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "mimetypes": { "type": "array", "items": { "type": "string" } }, "optionalMimetypes": { "type": "array", "items": { "type": "string" } }, "secure": { "type": "boolean" } } } }, "creators": { "type": "object", "additionalProperties": { "type": "object", "required": [ "id", "editor", "name", "extension", "templates", "mimetypes" ], "properties": { "id": { "type": "string" }, "editor": { "type": "string" }, "name": { "type": "string" }, "extension": { "type": "string" }, "templates": { "type": "boolean" }, "mimetypes": { "type": "array", "items": { "type": "string" } } } } } } } } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/directEditing/templates/{editorId}/{creatorId}": { "get": { "operationId": "direct_editing-templates", "summary": "Get the templates for direct editing", "tags": [ "direct_editing" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "editorId", "in": "path", "description": "ID of the editor", "required": true, "schema": { "type": "string" } }, { "name": "creatorId", "in": "path", "description": "ID of the creator", "required": true, "schema": { "type": "string" } }, { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Templates returned", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "templates" ], "properties": { "templates": { "type": "object", "additionalProperties": { "type": "object", "required": [ "id", "title", "preview", "extension", "mimetype" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "preview": { "type": "string", "nullable": true }, "extension": { "type": "string" }, "mimetype": { "type": "string" } } } } } } } } } } } } }, "500": { "description": "", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/directEditing/open": { "post": { "operationId": "direct_editing-open", "summary": "Open a file for direct editing", "tags": [ "direct_editing" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "path" ], "properties": { "path": { "type": "string", "description": "Path of the file" }, "editorId": { "type": "string", "nullable": true, "description": "ID of the editor" }, "fileId": { "type": "integer", "format": "int64", "nullable": true, "description": "ID of the file" } } } } } }, "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "URL for direct editing returned", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "url" ], "properties": { "url": { "type": "string" } } } } } } } } } }, "403": { "description": "Opening file is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } } } } } }, "500": { "description": "", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/directEditing/create": { "post": { "operationId": "direct_editing-create", "summary": "Create a file for direct editing", "tags": [ "direct_editing" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "path", "editorId", "creatorId" ], "properties": { "path": { "type": "string", "description": "Path of the file" }, "editorId": { "type": "string", "description": "ID of the editor" }, "creatorId": { "type": "string", "description": "ID of the creator" }, "templateId": { "type": "string", "nullable": true, "description": "ID of the template" } } } } } }, "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "URL for direct editing returned", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "url" ], "properties": { "url": { "type": "string" } } } } } } } } } }, "403": { "description": "Opening file is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } } } } } }, "500": { "description": "", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/templates": { "get": { "operationId": "template-list", "summary": "List the available templates", "tags": [ "template" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Available templates returned", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/TemplateFileCreator" } } } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/templates/create": { "post": { "operationId": "template-create", "summary": "Create a template", "tags": [ "template" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "filePath" ], "properties": { "filePath": { "type": "string", "description": "Path of the file" }, "templatePath": { "type": "string", "default": "", "description": "Name of the template" }, "templateType": { "type": "string", "default": "user", "description": "Type of the template" }, "templateFields": { "type": "array", "default": [], "description": "Fields of the template", "items": { "$ref": "#/components/schemas/TemplateField" } } } } } } }, "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Template created successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "$ref": "#/components/schemas/TemplateFile" } } } } } } } }, "403": { "description": "Creating template is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/templates/path": { "post": { "operationId": "template-path", "summary": "Initialize the template directory", "tags": [ "template" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "templatePath": { "type": "string", "default": "", "description": "Path of the template directory" }, "copySystemTemplates": { "type": "boolean", "default": false, "description": "Whether to copy the system templates to the template directory" } } } } } }, "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Template directory initialized successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "template_path", "templates" ], "properties": { "template_path": { "type": "string" }, "templates": { "type": "array", "items": { "$ref": "#/components/schemas/TemplateFileCreator" } } } } } } } } } } }, "403": { "description": "Initializing the template directory is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/transferownership": { "post": { "operationId": "transfer_ownership-transfer", "summary": "Transfer the ownership to another user", "tags": [ "transfer_ownership" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "recipient", "path" ], "properties": { "recipient": { "type": "string", "description": "Username of the recipient" }, "path": { "type": "string", "description": "Path of the file" } } } } } }, "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Ownership transferred successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } }, "400": { "description": "Transferring ownership is not possible", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } }, "403": { "description": "Transferring ownership is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/transferownership/{id}": { "post": { "operationId": "transfer_ownership-accept", "summary": "Accept an ownership transfer", "tags": [ "transfer_ownership" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "id", "in": "path", "description": "ID of the ownership transfer", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Ownership transfer accepted successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } }, "403": { "description": "Accepting ownership transfer is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } }, "404": { "description": "Ownership transfer not found", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } }, "delete": { "operationId": "transfer_ownership-reject", "summary": "Reject an ownership transfer", "tags": [ "transfer_ownership" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "id", "in": "path", "description": "ID of the ownership transfer", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Ownership transfer rejected successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } }, "403": { "description": "Rejecting ownership transfer is not allowed", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } }, "404": { "description": "Ownership transfer not found", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/openlocaleditor": { "post": { "operationId": "open_local_editor-create", "summary": "Create a local editor", "tags": [ "open_local_editor" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "path" ], "properties": { "path": { "type": "string", "description": "Path of the file" } } } } } }, "parameters": [ { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Local editor returned", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "userId", "pathHash", "expirationTime", "token" ], "properties": { "userId": { "type": "string", "nullable": true }, "pathHash": { "type": "string" }, "expirationTime": { "type": "integer", "format": "int64" }, "token": { "type": "string" } } } } } } } } } }, "500": { "description": "", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/openlocaleditor/{token}": { "post": { "operationId": "open_local_editor-validate", "summary": "Validate a local editor", "tags": [ "open_local_editor" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "path" ], "properties": { "path": { "type": "string", "description": "Path of the file" } } } } } }, "parameters": [ { "name": "token", "in": "path", "description": "Token of the local editor", "required": true, "schema": { "type": "string" } }, { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Local editor validated successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "userId", "pathHash", "expirationTime", "token" ], "properties": { "userId": { "type": "string" }, "pathHash": { "type": "string" }, "expirationTime": { "type": "integer", "format": "int64" }, "token": { "type": "string" } } } } } } } } } }, "404": { "description": "Local editor not found", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": {} } } } } } } } } } }, "/ocs/v2.php/apps/files/api/v1/folder-tree": { "get": { "operationId": "api-get-folder-tree", "summary": "Returns the folder tree of the user", "tags": [ "api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "path", "in": "query", "description": "The path relative to the user folder", "schema": { "type": "string", "default": "/" } }, { "name": "depth", "in": "query", "description": "The depth of the tree", "schema": { "type": "integer", "format": "int64", "default": 1 } }, { "name": "OCS-APIRequest", "in": "header", "description": "Required to be true for the API request to pass", "required": true, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "Folder tree returned successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FolderTree" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Invalid folder path", "content": { "application/json": { "schema": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } }, "404": { "description": "Folder not found", "content": { "application/json": { "schema": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" } } } } } } } } } }, "tags": [] }