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 TypeMethodDescriptionaddFile(AddFileRequest addFileRequest) Add a new file.Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated for removal.voidcleanTemporaryDirectory(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.voiddeleteFile(UUID fileId) Delete file with IDbooleanReturns true if a file with givenidexists.getFileAsStream(UUID fileId) Returns the content of given file or attachment as an input stream.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 usegetFileAsStream(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.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.getFileName(UUID fileId) Deprecated, for removal: This API element is subject to removal in a future version.Please usegetFileInfo(UUID)instead.newFileOutputStream(String fileName) Creates a new file and returns anOutputStreamto write its content, along with the file ID.voidUpdate the lastModified timestamp of the file
-
Method Details
-
newFileOutputStream
Creates a new file and returns anOutputStreamto write its content, along with the file ID. The caller is responsible for closing theOutputStream.- Parameters:
fileName- the name of the file to create- Returns:
- a
NewFileResponsecontaining the file ID and theOutputStreamto write to
-
addFile
Add a new file.- Parameters:
addFileRequest- the properties of the file to be added- Returns:
- The
FileInfocontaining 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. UseaddFile(AddFileRequest)Add a new file.- Parameters:
fileName- the name of the file in UUID format to addfile- the local file to addskipSecurity- This parameter is now ignored- Returns:
- The
FileInfocontaining metadata for the file
-
getFileAsStream
Returns the content of given file or attachment as an input stream. Keep in mind to useAttachmentApi.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- theidof the file- Returns:
- the content as
InputStream
-
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
Returns the information about a file with its ID.- Parameters:
fileId- The ID of the file represented as aUUID- Returns:
- The information about the file
-
getFileContent
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 usegetFileAsStream(UUID)instead.Returns contents of a file- Parameters:
fileId- The ID of the file represented as aUUID- Returns:
- a
invalid reference
byte[]
-
getFileInfoFromUrl
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, for removal: This API element is subject to removal in a future version.Please usegetFileInfo(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, 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
Returns true if a file with givenidexists.- Parameters:
fileId- theidof the issue- Returns:
- true if a file with given
idexists,falseotherwise
-
touchFile
Update the lastModified timestamp of the file- Parameters:
fileId- the Id of the file
-
deleteFile
Delete file with ID- Parameters:
fileId- the Id of the file
-