b2_list_file_versionsLists all of the versions of all of the files contained in one bucket, in alphabetical order by file name, and by reverse of date/time uploaded for versions of files with the same name. This call returns at most 1000 file names per transaction, but it can be called repeatedly to scan through all of the file names in a bucket. Each time you call, it returns a "nextFileName" and "nextFileId" that can be used as the starting point for the next call.
This call supports the same options for matching a file name prefix
and for grouping files into folders as
The application key you authorized with may restrict access to some files.
See RequestRequest HTTP HeadersAuthorization required
The account authorization token returned by Request HTTP Message Body ParametersbucketId required The bucket to look for file names in. startFileName optional
The first file name to return.
startFileId optional The first file ID to return. startFileName must also be provided if startFileId is specified. (See startFileName.) maxFileCount optional
The maximum number of files to return from this call. The
default value is 100, and the maximum is 10000. Passing
in 0 means to use the default of 100.
prefix optional Files returned will be limited to those with the given prefix. Defaults to the empty string, which matches all files. delimiter optional Files returned will be limited to those within the top folder, or any one subfolder. Defaults to NULL. Folder names will also be returned. The delimiter character will be used to "break" file names into folders. ResponseResponse HTTP Status 200List of file names as JSON: files An array of objects, each one describing one file. (See below.) nextFileName What to pass in to startFileName for the next search to continue where this one left off, or null if there are no more files. Note this this may not be the name of an actual file, but using it is guaranteed to find the next file version in the bucket. nextFileId What to pass in to startFileId for the next search to continue where this one left off, or null if there are no more files. Note this this may not be the ID of an actual file, but using it is guaranteed to find the next file version in the bucket. And each of the files is: accountId The account that owns the file. action
One of "start", "upload", "hide", "folder", or other values added
in the future.
"upload" means a file that was uploaded to B2 Cloud Storage.
"start" means that a large file has been started, but not
finished or canceled.
"hide" means a file version marking the file as hidden, so that it will not
show up in bucketId The bucket that the file is in. contentLength The number of bytes stored in the file. Only useful when the action is "upload". Always 0 when the action is "start", "hide", or "folder". contentSha1 The SHA1 of the bytes stored in the file as a 40-digit hex string. Large files do not have SHA1 checksums, and the value is "none". The value is null when the action is "hide" or "folder". contentType When the action is "upload" or "start", the MIME type of the file, as specified when the file was uploaded. For "hide" action, always "application/x-bz-hide-marker". For "folder" action, always null. fileId
The unique identifier for this version of this file.
Used with fileInfo The custom information that was uploaded with the file. This is a JSON object, holding the name/value pairs that were uploaded with the file. fileName
The name of this file, which can be used with
uploadTimestamp This is a UTC time when this file was
uploaded. It is a base 10 number of milliseconds since midnight,
January 1, 1970 UTC. This fits in a 64 bit integer such as the type "long"
in the programming language Java. It is intended to be compatible
with Java's time long. For example, it can be passed directly into
the java call Date.setTime(long time).
Response Errors
If possible the server will return a JSON error structure. Errors include:
API Versionsv2: Remove application key workaround (Sept 13, 2018)Listing file names will always return all of the file names you ask for. If your application key has a file name prefix restriction, and you ask for files outside that prefix, the call is unauthorized.
Now returns v1: Workaround for existing applications and application keys (August 9, 2018)When using an application key with a file name prefix restriction, a request to list files will be filtered to show only files allowed by the application key. v1: Original release (September 22, 2015)Original release.Sample CodeCode
Output
Code
Output
Code
Output
Code
Output
Code
Output
Code
Output
Code
Output
|