Install the Google Drive client libraries

The Google Drive API is built on HTTP and JSON, so any standard HTTP client can send requests to it and parse the responses.

However, the Google API client libraries provide better language integration, improved security, and facilitate making calls that require user authorization. The client libraries use each supported language's natural conventions and reduce boilerplate code that you have to write. The client libraries are available in several programming languages. By using them you can avoid the need to manually set up HTTP requests and parse the responses.

Read more about the Cloud Client Libraries and the older Google API Client Libraries in Client libraries explained.

Client libraries

Drive provides client libraries for the following languages. Select the programming language that you want to use.

Dart

Get the latest Google Drive API client library for Dart.

Run the following command to install this client library in your environment for Dart:

dart pub add googleapis

Run the following command to install this client library in your environment for Flutter:

flutter pub add googleapis

Code samples

To view or get individual code samples, see the googleapis.dart GitHub repository.

Client library documentation

For more information, view the client library documentation.

Go

Get the latest Google Drive API client library for Go.

Run the following command to install an API and a version of that API in your environment:

go get google.golang.org/api/urlshortener/v1

Code samples

To view or get individual code samples, see the google-api-go-client GitHub repository.

Client library documentation

For more information, view the client library documentation.

Java

Get the latest Google Drive API client library for Java.

To use Maven, add the following lines to your pom.xml file:

<project>
  <dependencies>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-drive</artifactId>
      <version>v3-rev20240509-2.0.0</version>
    </dependency>
  </dependencies>
</project>

To use Gradle, add the following lines to your build.gradle file:

repositories {
  mavenCentral()
}
dependencies {
  implementation 'com.google.apis:google-api-services-drive:v3-rev20240509-2.0.0'
}

Code samples

To view or get individual code samples, see the google-api-java-client-services GitHub repository.

Client library documentation

For more information, view the client library documentation.

JavaScript

Get the latest Google Drive API client library for JavaScript.

Use gapi.client.request to make requests to the JavaScript client library.

Code samples

To view or get individual code samples, see the google-api-javascript-client GitHub repository.

.NET

Get the latest Google Drive API client library for .NET.

Run the following command to install this package in your environment:

dotnet add package Google.Apis --version 1.68.0

For alternative methods of installation, see the Google.Apis NuGet page.

Code samples

To view or get individual code samples, see the Get started page.

Client library documentation

For more information, view the client library documentation.

Node.js

Get the latest Google Drive API client library for Node.js.

Run the following command to install this client library in your environment:

npm install @googleapis/drive

Code samples

To view or get individual code samples, see the google-api-nodejs-client GitHub repository.

Client library documentation

For more information, view the client library documentation.

Obj-C

Get the latest Google Drive API client library for Objective-C for REST.

If you're building from CocoaPods, add the required pod to the Podfile in your environment:

pod 'GoogleAPIClientForREST/Drive'

Code samples

To view or get individual code samples, see the google-api-objectivec-client-for-rest GitHub repository.

Client library documentation

For more information, view the client library documentation.

PHP

Get the latest Google Drive API client library for PHP.

To use Composer, run the following command to install this client library in your environment:

npm install @googleapis/drivecomposer require google/apiclient:^2.15.0

To download and install the release instead, extract the download file and include the autoloader in your project:

require_once '/path/to/google-api-php-client/vendor/autoload.php';

Code samples

To view or get individual code samples, see the google-api-php-client GitHub repository.

Client library documentation

For more information, view the client library documentation.

Python

Get the latest Google Drive API client library for Python.

Install this client library in a virtualenv in your environment using pip.

To install on Mac or Linux:

pip3 install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-api-python-client

To install on Windows:

pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-api-python-client

Code samples

To view or get individual code samples, see the google-api-python-client GitHub repository.

Client library documentation

For more information, view the client library documentation.

Ruby

Get the latest Google Drive API client library for Ruby.

To use gem install, run the following command to install this client library in your environment:

gem install google-apis-drive_v3 -v 0.5.0

To require the file instead, add it to your Gemfile, add the require statement in your project, and instantiate the service:

require 'google/apis/drive_v3'
drive = Google::Apis::DriveV3::DriveService.new

Code samples

To view or get individual code samples, see the google-api-ruby-client GitHub repository.

Client library documentation

For more information, view the client library documentation.