Promote a specific version of a file.
If previous versions exist, this method can be used to promote one of the older versions to the top of the version history.
This creates a new copy of the old version and puts it at the
top of the versions history. The file will have the exact same contents
as the older version, with the the same hash digest, etag
, and
name as the original.
Other properties such as comments do not get updated to their former values.
Don't use this endpoint to restore Box Notes, as it works with file formats such as PDF, DOC, PPTX or similar.
12345
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
.
id,type,name
A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.
Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.
"11446498"
The file version ID
"file_version"
The type to promote
Value is always file_version
Returns a newly created file version object.
An unexpected client error.
curl -i -X POST "https://api.box.com/2.0/files/12345/versions/current" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"type": "file_version",
"id": "456456"
}'
await client.fileVersions.promoteFileVersion(file.id, {
requestBody: {
id: fileVersions.entries![0].id,
type: 'file_version' as PromoteFileVersionRequestBodyTypeField,
} satisfies PromoteFileVersionRequestBody,
} satisfies PromoteFileVersionOptionalsInput);
client.file_versions.promote_file_version(
file.id,
id=file_versions.entries[0].id,
type=PromoteFileVersionType.FILE_VERSION.value,
)
await client.FileVersions.PromoteFileVersionAsync(fileId: file.Id, requestBody: new PromoteFileVersionRequestBody() { Id = NullableUtils.Unwrap(fileVersions.Entries)[0].Id, Type = PromoteFileVersionRequestBodyTypeField.FileVersion });
try await client.fileVersions.promoteFileVersion(fileId: file.id, requestBody: PromoteFileVersionRequestBody(id: fileVersions.entries![0].id, type: PromoteFileVersionRequestBodyTypeField.fileVersion))
BoxFile file = new BoxFile(api, "id");
Collection<BoxFileVersion> versions = file.getVersions();
BoxFileVersion firstVersion = versions.iterator().next();
firstVersion.promote();
file_id = '11111'
file_version_id = '12345'
version_to_promote = client.file_version(file_version_id)
new_version = client.file(file_id).promote_version(version_to_promote)
print(f'Version {file_version_id} promoted; new version {new_version.id} created')
string fileId = "11111";
BoxFileVersion current = await client.FilesManager.PromoteVersionAsync(fileId, versionId: "22222");
var fileID = '11111';
var versionID = '22222';
client.files.promoteVersion(fileID, versionID)
.then(version => {
/* version -> {
type: 'file_version',
id: '33333',
sha1: '12039d6dd9a7e6eefc78846802e',
name: 'Stark Family Lineage.pptx',
size: 37934912,
created_at: '2013-11-20T13:20:50-08:00',
modified_at: '2013-11-20T13:26:48-08:00',
modified_by:
{ type: 'user',
id: '44444',
name: 'Eddard Stark',
login: 'ned@winterfell.example.com' } }
*/
});
{
"id": "12345",
"type": "file_version",
"created_at": "2012-12-12T10:53:43-08:00",
"modified_at": "2012-12-12T10:53:43-08:00",
"modified_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"name": "tigers.jpeg",
"purged_at": "2012-12-12T10:53:43-08:00",
"restored_at": "2012-12-12T10:53:43-08:00",
"restored_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
"size": 629644,
"trashed_at": "2012-12-12T10:53:43-08:00",
"trashed_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"uploader_display_name": "Ellis Wiggins",
"version_number": "1"
}