Retrieve a list of the past versions for a file.
Versions are only tracked by Box users with premium accounts. To fetch the ID
of the current version of a file, use the GET /file/:id
API.
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.
1000
1000
The maximum number of items to return per page.
1000
0
The offset of the item at which to begin the response.
Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
Returns an array of past versions for this file.
An unexpected client error.
curl -i -X GET "https://api.box.com/2.0/files/12345/versions" \
-H "authorization: Bearer <ACCESS_TOKEN>"
await client.fileVersions.getFileVersions(file.id);
client.file_versions.get_file_versions(file.id)
await client.FileVersions.GetFileVersionsAsync(fileId: file.Id);
BoxFile file = new BoxFile(api, "id");
Collection<BoxFileVersion> versions = file.getVersions();
for (BoxFileVersion version : versions) {
System.out.format("SHA1 of \"%s\": %s\n", file.getInfo().getName(), version.getSha1());
}
file_id = '11111'
file_versions = client.file(file_id).get_previous_versions()
for version in file_versions:
print(f'File version {version.id} was created at {version.created_at}')
BoxCollection<BoxFileVersion> previousVersions = await client.FilesManager
.ViewVersionsAsync(id: "11111");
client.files.getVersions('12345')
.then(versions => {
/* versions -> {
total_count: 1,
entries:
[ { type: 'file_version',
id: '22222',
sha1: '359c6c1ed98081b9a69eb3513b9deced59c957f9',
name: 'script.js',
size: 92556,
created_at: '2012-08-20T10:20:30-07:00',
modified_at: '2012-11-28T13:14:58-08:00',
modified_by:
{ type: 'user',
id: '33333',
name: 'Example User',
login: 'user@example.com' } } ] }
*/
});
{
"entries": [
{
"id": "12345",
"type": "file_version",
"sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
"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"
},
"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"
}
],
"limit": 1000,
"offset": 2000,
"order": [
{
"by": "type",
"direction": "ASC"
}
],
"total_count": 5000
}