The latest version of the Google Drive API is v3. The performance in v3 is better because searches only return a subset of fields. Use the current version unless you need the apps collection. If you are using v2 and your app doesn't use the apps collection, consider migrating to v3. To migrate, see Migrate to v3. For a complete list of version differences, see V2 to v3 reference.
To learn more about the improvements to Google Drive API v3, you can watch the following video of Google engineers discussing the new API design.
To optimize performance and reduce API behavior complexity, v3 provides these improvements over the previous API version:
- Searches for files and shared drives do not return full resources by default, only
a subset of commonly used fields get returned. For more details about
fields, see files:list and drives:list.
- Almost all methods that return a response now require the
fieldsparameter. For a list of all methods that require
fields, see the API reference.
- Resources that have duplicate capabilities were removed. Some examples:
files.listmethod accomplishes the same functionality as
Parentscollections, so they are gone from v3.
Realtime.*methods have been removed. See the Realtime API documentation for alternatives.
- App Data is not returned by default in searches. In v2, you can set the
drive.appdatascope, and it returns application data from
changes.list, but it slows performance. In v3, you set the
drive.appdatascope, and also set the query parameter
spaces=appDataFolderto request application data.
- All update operations use PATCH instead of PUT
- To export Google Documents, use
exportLinksfield has been removed from
changes.listbehavior is different. Instead of change ids, use opaque page tokens. To poll the change collection, first call
changes.getStartPageTokenfor the initial value. For subsequent queries,
- Update methods now reject requests which specify non-writable fields.
- The v2
Aboutare lists of allowable import or export formats. In v3, they are MIME type maps of possible targets to all supported imports or exports.
- The v2
appfolderaliases are now
Propertiescollection is removed from v3. The
Filesresource has the
propertiesfield that contain true key-value pairs. The
propertiesfield contains public properties, and
appPropertiescontain private properties, so the visibility field is not needed.
modifiedTimefield updates the last time the file was modified by anyone. In v2, the
modifiedDatefield was only mutable on update if you have set the
viewedByMeTimefield does not automatically update.
- To import Google Docs formats, you set the appropriate target
mimeTypein the resource body. In v2, you set
- Import operations return a 400 error if the format is not supported.
- Readers and commenters can't view permissions.
mealias for permissions is gone.
- Some functionality was available as part of the request resource, to instead be available
as a request parameter. For example:
- In v2, you can use
children.deleteto remove a child file from a parent folder.
- In v3, you use
files.updateon the child with
?removeParents=parent_idin the URL.
- In v2, you can use
Fields and parameter names are different in v3. See tables below for all v2 to v3 changes.
Some examples include:
name property replaces
Time is the suffix for all date and time fields instead of
* List operations don't use the
items field to contain the result set. The
resource type provides a field for the results (e.g.