Applications typically store configuration files and other data not intended to be directly accessed by users. Photos space - The photos space includes all user-visible image files created or stored in Google Drive. Collections of files used to narrow the scope of file and folder searches. The corpora for Drive are: user , domain , drive , and allDrives. User corpora - The user corpora includes all files in "My Drive" and "Shared with me. Domain corpora - The domain corpora includes all files shared to the user's domain that are searchable.
Drive corpora - The drive corpora includes all files contained in a single shared drive. All drives corpora - The allDrives corpora includes all files in shared drives that the user is a member of and all files in "My Drive" and "Shared with me.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4. For details, see the Google Developers Site Policies.
Guides Reference Samples Support Switch to v2. Manage files and folders. Handle changes and revisions. Integrate with the Drive UI. Integrate Drive widgets into your web app. Integrate with shared drives.
Handle errors and improve performance. Publish your Drive app. Stay updated. Notice: important security update for Drive document URLs and resource keys. For more information, refer to Access link-shared files using resource keys. Ownership Drive organizes files based on the user's relationship with the content as well as its storage location.
My Drive Each user has a "root" folder called "My Drive" that functions as their primary hierarchy, and consists of everything that descends from this root folder. The user is the primary owner of this folder. Shared drives A shared drive is an organizational structure within Google Drive that lives parallel to My Drive.
For more information, refer to Access link-shared files using resource keys. Google Drive API Relationship Diagram These terms define the key components shown in Figure 1 : Google Drive Google's cloud file storage service that provides users with a personal storage space, called My Drive , and the option to access collaborative shared folders, called shared drives. Google Drive app An app that leverages Google Drive as its storage solution.
If your app is an editor-type app, such as a spreadsheet or word processor app, you can integrate with the Drive UI to create and open files within your app. My Drive A Google Drive storage location that a specific user owns. Files stored on My Drive can be shared with other users, but ownership of the content remains specific to an individual user. OAuth 2. If your application uses Google Sign-in , it handles the OAuth 2. Shared drive A Google Drive storage location that owns files that multiple users share to collaborate.
Any user with access to a shared drive has access to all files it contains. Upload the content in multiple chunks. Use this approach if you need to reduce the amount of data transferred in any single request. You might need to reduce data transferred when there is a fixed time limit for individual requests, as can be the case for certain classes of Google App Engine requests.
This approach is also useful if you need to provide a customized indicator to show the upload progress. Add the chunk's data to the request body. Create chunks in multiples of KB x bytes in size, except for the final chunk that completes the upload. Keep the chunk size as large as possible so that the upload is efficient. Send the request, and process the response. If the upload request is interrupted, or if you receive a 5xx response, follow the procedure in Resume an interrupted upload.
Repeat steps 1 through 4 for each chunk that remains in the file. Use the Range header in the response to determine where to start the next chunk. Do not assume that the server received all bytes sent in the previous request. When the entire file upload is complete, you receive a OK or Created response, along with any metadata associated with the resource.
If an upload request is terminated before a response, or if you receive a Service Unavailable response, then you need to resume the interrupted upload. Add a Content-Range header to indicate that the current position in the file is unknown.
If you received a Resume Incomplete response, process the response's Range header, to determine which bytes the server has received. If the response doesn't have a Range header, no bytes have been received.
Now that you know where to resume the upload, continue to upload the file beginning with the next byte. Include a Content-Range header to indicate which portion of the file you send. When you create a file in Google Drive, you might want to convert the file into a Google Workspace file type, such as a Google Doc or Sheet.
For example, maybe you want to convert a document from your favorite word processor into a Google Doc to take advantage of Google Doc's features. To convert a file to a specific Google Workspace file type, specify the Google Workspace mimeType when creating the file.
To see if a conversion is available, check the About resource's importFormats array prior to creating the file. Supported conversions are available dynamically in this array. Some common import formats are:. When you upload and convert media during an update request to a Google Doc, Sheet, or Slide, the full contents of the document are replaced. The extracted text appears in the Google Docs document alongside the embedded image. Upload and file creation requests can use these pregenerated IDs.
Set the id field in the file metadata. To create pregenerated IDs, call file. You can safely retry uploads with pregenerated IDs in the case of an indeterminate server error or timeout. If the file was successfully created, subsequent retries return a HTTP error, they do not create duplicate files. Users can use the Drive UI to search for document content. You can also use the file. For further information on searching for files, refer to Search for files and folders.
0コメント