Skip to content

Latest commit

 

History

History
245 lines (161 loc) · 8.11 KB

files.md

File metadata and controls

245 lines (161 loc) · 8.11 KB

FilesManager

Get file information

Retrieves the details about a file.

This operation is performed by calling function getFileById.

See the endpoint docs at API Reference.

client.getFiles().getFileById(uploadedFile.getId(), new GetFileByIdQueryParams.GetFileByIdQueryParamsBuilder().fields(Arrays.asList("is_externally_owned", "has_collaborations")).build())

Arguments

  • fileId String
    • The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123. Example: "12345"
  • queryParams GetFileByIdQueryParams
    • Query parameters of getFileById method
  • headers GetFileByIdHeaders
    • Headers of getFileById method

Returns

This function returns a value of type FileFull.

Returns a file object.

Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.

Update file

Updates a file. This can be used to rename or move a file, create a shared link, or lock a file.

This operation is performed by calling function updateFileById.

See the endpoint docs at API Reference.

client.getFiles().updateFileById(fileToUpdate.getId(), new UpdateFileByIdRequestBody.UpdateFileByIdRequestBodyBuilder().name(updatedName).description("Updated description").build())

Arguments

  • fileId String
    • The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123. Example: "12345"
  • requestBody UpdateFileByIdRequestBody
    • Request body of updateFileById method
  • queryParams UpdateFileByIdQueryParams
    • Query parameters of updateFileById method
  • headers UpdateFileByIdHeaders
    • Headers of updateFileById method

Returns

This function returns a value of type FileFull.

Returns a file object.

Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.

Delete file

Deletes a file, either permanently or by moving it to the trash.

The the enterprise settings determine whether the item will be permanently deleted from Box or moved to the trash.

This operation is performed by calling function deleteFileById.

See the endpoint docs at API Reference.

client.getFiles().deleteFileById(thumbnailFile.getId())

Arguments

  • fileId String
    • The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123. Example: "12345"
  • headers DeleteFileByIdHeaders
    • Headers of deleteFileById method

Returns

This function returns a value of type void.

Returns an empty response when the file has been successfully deleted.

Copy file

Creates a copy of a file.

This operation is performed by calling function copyFile.

See the endpoint docs at API Reference.

client.getFiles().copyFile(fileOrigin.getId(), new CopyFileRequestBody.CopyFileRequestBodyBuilder(new CopyFileRequestBodyParentField("0")).name(copiedFileName).build())

Arguments

  • fileId String
    • The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123. Example: "12345"
  • requestBody CopyFileRequestBody
    • Request body of copyFile method
  • queryParams CopyFileQueryParams
    • Query parameters of copyFile method
  • headers CopyFileHeaders
    • Headers of copyFile method

Returns

This function returns a value of type FileFull.

Returns a new file object representing the copied file.

Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.

Get file thumbnail URL

Get the download URL without downloading the content.

This operation is performed by calling function getFileThumbnailUrl.

See the endpoint docs at API Reference.

client.getFiles().getFileThumbnailUrl(thumbnailFile.getId(), GetFileThumbnailUrlExtension.PNG)

Arguments

  • fileId String
    • The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123. Example: "12345"
  • extension GetFileThumbnailUrlExtension
    • The file format for the thumbnail Example: "png"
  • queryParams GetFileThumbnailUrlQueryParams
    • Query parameters of getFileThumbnailById method
  • headers GetFileThumbnailUrlHeaders
    • Headers of getFileThumbnailById method

Returns

This function returns a value of type String.

When a thumbnail can be created the thumbnail data will be returned in the body of the response.Sometimes generating a thumbnail can take a few seconds. In these situations the API returns a Location-header pointing to a placeholder graphic for this file type.

The placeholder graphic can be used in a user interface until the thumbnail generation has completed. The Retry-After-header indicates when to the thumbnail will be ready. At that time, retry this endpoint to retrieve the thumbnail.

Get file thumbnail

Retrieves a thumbnail, or smaller image representation, of a file.

Sizes of 32x32,64x64, 128x128, and 256x256 can be returned in the .png format and sizes of 32x32, 160x160, and 320x320 can be returned in the .jpg format.

Thumbnails can be generated for the image and video file formats listed found on our community site.

This operation is performed by calling function getFileThumbnailById.

See the endpoint docs at API Reference.

client.getFiles().getFileThumbnailById(thumbnailFile.getId(), GetFileThumbnailByIdExtension.PNG)

Arguments

  • fileId String
    • The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123. Example: "12345"
  • extension GetFileThumbnailByIdExtension
    • The file format for the thumbnail Example: "png"
  • queryParams GetFileThumbnailByIdQueryParams
    • Query parameters of getFileThumbnailById method
  • headers GetFileThumbnailByIdHeaders
    • Headers of getFileThumbnailById method

Returns

This function returns a value of type InputStream.

When a thumbnail can be created the thumbnail data will be returned in the body of the response.Sometimes generating a thumbnail can take a few seconds. In these situations the API returns a Location-header pointing to a placeholder graphic for this file type.

The placeholder graphic can be used in a user interface until the thumbnail generation has completed. The Retry-After-header indicates when to the thumbnail will be ready. At that time, retry this endpoint to retrieve the thumbnail.