File
Stores the attributes of a file or directory.
FileInfo object
Stores the attributes of a file or directory.
- pathstring
The absolute path of the file or directory.
- is_dirboolean
True if the path is a directory.
- file_sizeint64
The length of the file in bytes. Set to 0 for directories.
- modification_timeint64
Last modification time of given file in milliseconds since epoch.
Get GA
Create GA
PUT
Uploads a file of up to 5 GiB. The file contents should be sent as the request body as raw bytes (an octet stream); do not encode or otherwise modify the bytes before sending. The contents of the resulting file will be exactly the bytes sent in the request body. If the request is successful, there is no response body.
API scopes: files
Parameters
- file_pathstringpath
The absolute path of the file.
- overwritebooleanquery
If true or unspecified, an existing file will be overwritten. If false, an error will be returned if the path points to an existing file.
Request body
- contentsstring
Delete GA
Create Directory GA
PUT
Creates an empty directory. If necessary, also creates any parent directories of the
new, empty directory (like the shell command mkdir -p). If called on an existing
directory, returns a success response; this method is idempotent (it will succeed if the directory already
exists).
API scopes: files
Parameters
- directory_pathstringpath
The absolute path of a directory.
Delete Directory GA
DELETE
Deletes an empty directory.
To delete a non-empty directory, first delete all of its contents. This can be done by listing the directory contents and deleting each file and subdirectory recursively.
API scopes: files
Parameters
- directory_pathstringpath
The absolute path of a directory.
Download File GA
GET
Downloads a file. The file contents are the response body. This is a standard HTTP file download, not a JSON RPC. It supports the Range and If-Unmodified-Since HTTP headers.
API scopes: files
Parameters
- file_pathstringpath
The absolute path of the file.
Response
- contentsstring
Get Directory Metadata GA
HEAD
Get the metadata of a directory. The response HTTP headers contain the metadata. There is no response body.
This method is useful to check if a directory exists and the caller has access to it.
If you wish to ensure the directory exists, you can instead use PUT, which will create
the directory if it does not exist, and is idempotent (it will succeed if the directory
already exists).
API scopes: files
Parameters
- directory_pathstringpath
The absolute path of a directory.
List Directory Contents GA
GET
Returns the contents of a directory. If there is no directory at the specified path, the API returns an HTTP 404 error.
API scopes: files
Parameters
- directory_pathstringpath
The absolute path of a directory.
- page_sizeint64query
The maximum number of directory entries to return. The response may contain fewer entries. If the response contains a
next_page_token, there may be more entries, even if fewer thanpage_sizeentries are in the response.We recommend not to set this value unless you are intentionally listing less than the complete directory contents.
If unspecified, at most 1000 directory entries will be returned. The maximum value is 1000. Values above 1000 will be coerced to 1000.
- page_tokenstringquery
An opaque page token which was the
next_page_tokenin the response of the previous request to list the contents of this directory. Provide this token to retrieve the next page of directory entries. When providing apage_token, all other parameters provided to the request must match the previous request. To list all of the entries in a directory, it is necessary to continue requesting pages of entries until the response contains nonext_page_token. Note that the number of entries returned must not be used to determine when the listing is complete.
Response
- contentsarray of object
Array of DirectoryEntry.
Show child attributesHide child attributes
- file_sizeint32
The length of the file in bytes. This field is omitted for directories.
- is_directoryboolean
True if the path is a directory.
- last_modifiedint32
Last modification time of given file in milliseconds since unix epoch.
- namestring
The name of the file or directory. This is the last component of the path.
- pathstring
The absolute path of the file or directory.
- next_page_tokenstring
A token, which can be sent as
page_tokento retrieve the next page.