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 represent 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.
Returns an array of past versions for this file.
An unexpected client error.
curl -X GET https://api.box.com/2.0/files/12345/versions \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
BoxCollection<BoxFileVersion> previousVersions = await client.FilesManager
.ViewVersionsAsync(id: "11111");
BoxFile file = new BoxFile(api, "id");
List<BoxFileVersion> versions = file.getVersions();
for (BoxFileVersion version : versions) {
System.out.format("SHA1 of \"%s\": %s\n", item.getName(), version.getSha1());
}
file_id = '11111'
file_versions = client.file(file_id).get_previous_versions()
for version in file_versions:
print('File version {0} was created at {1}'.format(version.id, version.created_at))
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' } } ] }
*/
});