Interface FileApi


public interface FileApi
Public API for the management of files.



Note: Resources are always referenced by their id, represented as a UUID. A resource id is a UUID which uniquely identifies the resource.
When the resource is referenced differently (not with the id) it will be specified in the parameter name and its documentation.

  • Method Summary

    Modifier and Type
    Method
    Description
    addFile(AddFileRequest addFileRequest)
    Add a new file.
    addFile(String fileName, File file, boolean skipSecurity)
    Deprecated, for removal: This API element is subject to removal in a future version.
    This method is deprecated for removal.
    void
    cleanTemporaryDirectory(long timeToLive)
    Deprecated, for removal: This API element is subject to removal in a future version.
    This is now a no-op, as cleanup is handled automatically.
    void
    deleteFile(UUID fileId)
    Delete file with ID
    boolean
    exists(UUID fileId)
    Returns true if a file with given id exists.
    Returns the content of given file or attachment as an input stream.
    byte[]
    Deprecated, for removal: This API element is subject to removal in a future version.
    This method can fill the memory of the application if used for large files, please use getFileAsStream(UUID) instead.
    Deprecated, for removal: This API element is subject to removal in a future version.
    The directory returned is not linked to the implementation of this API, temporary directory should be retrieved through other means.
    getFileInfo(UUID fileId)
    Returns the information about a file with its ID.
    Deprecated, for removal: This API element is subject to removal in a future version.
    This cannot be guaranteed to support all files.
    getFileName(UUID fileId)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Please use getFileInfo(UUID) instead.
    Creates a new file and returns an OutputStream to write its content, along with the file ID.
    void
    touchFile(UUID fileId)
    Update the lastModified timestamp of the file
  • Method Details

    • newFileOutputStream

      NewFileResponse newFileOutputStream(String fileName)
      Creates a new file and returns an OutputStream to write its content, along with the file ID. The caller is responsible for closing the OutputStream.
      Parameters:
      fileName - the name of the file to create
      Returns:
      a NewFileResponse containing the file ID and the OutputStream to write to
    • addFile

      FileInfo addFile(AddFileRequest addFileRequest)
      Add a new file.
      Parameters:
      addFileRequest - the properties of the file to be added
      Returns:
      The FileInfo containing metadata for the file
    • addFile

      @Deprecated(forRemoval=true, since="2026.04") FileInfo addFile(String fileName, File file, boolean skipSecurity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is deprecated for removal. Use addFile(AddFileRequest)
      Add a new file.
      Parameters:
      fileName - the name of the file in UUID format to add
      file - the local file to add
      skipSecurity - This parameter is now ignored
      Returns:
      The FileInfo containing metadata for the file
    • getFileAsStream

      InputStream getFileAsStream(UUID fileId)
      Returns the content of given file or attachment as an input stream. Keep in mind to use AttachmentApi.getAttachmentContent(java.util.UUID) instead of this endpoint when you want to get the file of an attachment. A File and its id can be temporary so it's possible this endpoint will not get you the desired file.
      Parameters:
      fileId - the id of the file
      Returns:
      the content as InputStream
    • getFileDirectory

      @Deprecated(forRemoval=true, since="2026.04") File getFileDirectory()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The directory returned is not linked to the implementation of this API, temporary directory should be retrieved through other means.
      Returns the temporary directory of DGC.
      Returns:
      the directory
    • getFileInfo

      FileInfo getFileInfo(UUID fileId)
      Returns the information about a file with its ID.
      Parameters:
      fileId - The ID of the file represented as a UUID
      Returns:
      The information about the file
    • getFileContent

      @Deprecated(forRemoval=true, since="2026.04") byte[] getFileContent(UUID fileId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method can fill the memory of the application if used for large files, please use getFileAsStream(UUID) instead.
      Returns contents of a file
      Parameters:
      fileId - The ID of the file represented as a UUID
      Returns:
      a
      invalid reference
      byte[]
    • getFileInfoFromUrl

      @Deprecated(forRemoval=true, since="2026.04") FileInfo getFileInfoFromUrl(String fileUrl)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This cannot be guaranteed to support all files. Please extract the file ID instead to retrieve its metadata.
      Returns the information about the file for the given url.
      Parameters:
      fileUrl - the url of the file to get
      Returns:
      the FileInfo
    • getFileName

      @Deprecated(forRemoval=true, since="2026.04") String getFileName(UUID fileId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Please use getFileInfo(UUID) instead.
      Returns the name of the file.
      Parameters:
      fileId - The ID of the file for which to get name
      Returns:
      a file name
    • cleanTemporaryDirectory

      @Deprecated(forRemoval=true, since="2026.04") void cleanTemporaryDirectory(long timeToLive)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This is now a no-op, as cleanup is handled automatically.
      Removes files that are older than the given time to live.
      Parameters:
      timeToLive - Duration that a file can exist in milliseconds before it is removed
    • exists

      boolean exists(UUID fileId)
      Returns true if a file with given id exists.
      Parameters:
      fileId - the id of the issue
      Returns:
      true if a file with given id exists, false otherwise
    • touchFile

      void touchFile(UUID fileId)
      Update the lastModified timestamp of the file
      Parameters:
      fileId - the Id of the file
    • deleteFile

      void deleteFile(UUID fileId)
      Delete file with ID
      Parameters:
      fileId - the Id of the file