The latest Google Drive API version is v3. The performance in v3 is better because searches only return a subset of fields. Use the current version unless you need the v2 collection. If you're using v2, consider migrating to v3. To migrate, see Migrate to Drive API v3. For a complete list of version differences, see the Drive API v2 and v3 comparison reference.
If you want to continue to use v2, see the Guide to Drive API v2 amendment to learn how some instructions in the v3 guides must be amended for v2 developers.
To learn more about Drive API v3 improvements, you can watch the following video by Google engineers discussing the new API design.
V3 improvements
To optimize performance and reduce API behavior complexity, v3 provides these improvements over the previous API version:
- Searches for files and shared drives don't return full resources by default,
only a subset of commonly used fields gets returned. For more details on
fields, see thefiles.listmethod and thedrives.listmethod. - Almost all methods that return a response now require the
fieldsparameter. For a list of all methods requiringfields, see the Drive API reference. - Resources that have duplicate capabilities were removed. Some examples:
- The
files.listmethod accomplishes the same functionality as theChildrenandParentscollections, so they're removed from v3. - The
Realtime.*methods have been removed.
- The
- App Data isn't returned by default in searches. In v2, you can set the
drive.appdatascope, and it returns application data from thefiles.listmethod and thechanges.listmethod, but it slows performance. In v3, you set thedrive.appdatascope, and also set the query parameterspaces=appDataFolderto request application data. - All update operations use PATCH instead of PUT.
- To export Google Documents, use the
files.exportmethod. - The
changes.listmethod behavior is different. Instead of change IDs, use opaque page tokens. To poll the change collection, first call thechanges.getStartPageTokenmethod for the initial value. For subsequent queries, thechanges.listmethod returns thenewStartPageTokenvalue. - Update methods now reject requests that specify non-writable fields.
- The v2
exportFormatsandimportFormatsfields in theaboutresource are lists of allowable import or export formats. In v3, they're MIME type maps of possible targets to all supported imports or exports. - The v2
appdataandappfolderaliases are nowappDataFolderin v3. - The
propertiesresource is removed from v3. Thefilesresource has thepropertiesfield that contains true key-value pairs. Thepropertiesfield contains public properties, and theappPropertiesfield contains private properties, so the visibility field isn't needed. - The
modifiedTimefield in thefilesresource updates the last time anyone modified the file. In v2, themodifiedDatefield was only mutable on update if you set thesetModifiedDatefield. - The
viewedByMeTimefield in thefilesresource doesn't automatically update. - To import Google Docs formats, you set the appropriate target
mimeTypein the resource body. In v2, you set?convert=true. - Import operations return a 400 error if the format isn't supported.
- Readers and commenters can't view permissions.
- The
mealias for permissions is removed. - Some functionality was available as part of the request resource but is
instead 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
Other differences
Fields and parameter names are different in v3. Some examples include:
- The
nameproperty replacestitlein thefilesresource. Timeis the suffix for all date and time fields instead ofDate.- List operations don't use the
itemsfield to contain the result set. The resource type provides a field for the results (such asfilesorchanges).