Google Drive SDK

Migrate to Google Drive API v2

If you have existing apps based on Drive API v1 or the Documents List API v3, you can migrate to Drive API v2. The differences between Drive API v1 and v2 are mainly additions of new functionality, with the exceptions described in Migrating from Drive API v1. Considerations for migrating from the Documents List API are also detailed in this page.

Migrating from Google Drive API v1

Drive API v2 adds the following non-backward compatible changes from v1:

  • The parameter id from files.update and files.get has been renamed to fileId
  • The parentsCollection field in files listing parents has been renamed to parents

Migrating from the Documents List API

Developers using the Documents List API who want to update their apps to use the Drive API v2 can use this guide as a reference for their migration.

The Drive API v2 is built on Google's new JSON-based API infrastructure, which is not backward compatible with the XML-based Documents List API v3.

For more information about the resources available in the Drive API v2, see the API Reference.

Authorizing requests

The authorization scopes accepted by the Documents List API have been replaced by several new scopes. Scopes supported by the Documents List API are also supported by the Drive API, but new applications should use the existing Drive scopes.

The following table maps the currently supported scopes to their Drive equivalents:

Documents List API Drive API
https://docs.google.com/feeds/ https://www.googleapis.com/auth/drive
https://docs.googleusercontent.com/ https://www.googleapis.com/auth/drive

Retrieving user information

The Metadata feed exposed by the Documents List API to provide information about the feature set available to a given user account has been replaced by the About resource in the Drive API.

The following table maps the endpoints for the Metadata feed in the Documents List API with those for the About resource in the Drive API:

Documents List API Drive API
https://docs.google.com/feeds/metadata/default https://www.googleapis.com/drive/v2/about
https://docs.google.com/feeds/metadata/<userId> Not available

Detecting changes to resources

The Documents List API exposes the Changes feed to provide information about all changes to all resources. Drive API v2 exposes a JSON-based Changes feed at a different endpoint, as detailed below.

The following table maps the endpoints for the Changes feed in the Documents List API with those for the Changes feed in the Drive API:

Documents List API Drive API
https://docs.google.com/feeds/default/private/changes https://www.googleapis.com/drive/v2/changes
https://docs.google.com/feeds/default/private/changes/<changeId> https://www.googleapis.com/drive/v2/changes/<changeId>

Managing document and file metadata and content

The primary feed to manage documents and files with the Documents List API has been replaced by the Files feed in the Drive API.

The following table maps the endpoints for the primary feed in the Documents List API with those for the Files feed in the Drive API:

Documents List API Drive API
https://docs.google.com/feeds/default/private/full https://www.googleapis.com/drive/v2/files
https://docs.google.com/feeds/default/private/full/<resourceId> https://www.googleapis.com/drive/v2/files/<fileId>

Managing revisions of documents and files

The Documents List API exposes the Revisions feed to provide information about document and file revisions. Drive API v2 exposes a JSON-based Revisions feed at a different endpoint, as detailed below.

The following table maps the endpoints for the Revisions feed in the Documents List API with those for the Revisions feed in the Drive API:

Documents List API Drive API
https://docs.google.com/feeds/default/private/full/<resourceId>/revisions https://www.googleapis.com/drive/v2/files/<fileId>/revisions
https://docs.google.com/feeds/default/private/full/<resourceId>/revisions/<revisionId> https://www.googleapis.com/drive/v2/files/<fileId>/revisions/<revisionId>

Managing collections and their contents

The Drive API replaces the concept of Collections in the Documents List API with folders and exposes their contents in the Children feed. Similarly, resources can now access the Parents feed to retrieve the folders that contain them.

The following table maps the endpoints for the Folder content feed in the Documents List API with those for the Children feed and Parents feed in the Drive API:

Documents List API Drive API
https://docs.google.com/feeds/default/private/full/folder:<folderId>/contents https://www.googleapis.com/drive/v2/files/<folderId>/children
https://docs.google.com/feeds/default/private/full/folder:<folderId>/contents/<childId> https://www.googleapis.com/drive/v2/files/<folderId>/children/<childId>
Not available https://www.googleapis.com/drive/v2/files/<fileId>/parents
Not available https://www.googleapis.com/drive/v2/files/<fileId>/parents/<parentId>

Sharing resources via ACLs

The ACL feed exposed by the Documents List API to manage resource sharing has been replaced by the Permissions feed in the Drive API.

The following table maps the endpoints for the ACL feed in the Documents List API with those for the Permissions feed in the Drive API:

Documents List API Drive API
https://docs.google.com/feeds/default/private/full/<resourceId>/acl https://www.googleapis.com/drive/v2/files/<fileId>/permissions
https://docs.google.com/feeds/default/private/full/<resourceId>/acl/<aclId> https://www.googleapis.com/drive/v2/files/<fileId>/permissions/<aclId>

Functionality not supported by Drive API v2

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.