If you don't want to write your own code to send HTTP requests and parse the responses, then you need to download a client library.
How to set up a client library varies by programming language. In the following section, select the language you're using for development.
If you want to use a language that isn't available, check the list of client libraries to see if there's a library for your language.
Note: One of the main tasks of the client libraries is converting between JSON and native objects. In the Java library, this is done by a set of classes provided by a jar file. In Python, JSON is converted directly into a dictionary or hash.
Java
Using the Google APIs Client Library for Java requires that you download the core Java client library and the Google Drive Activity API Java library.
This page contains information about getting started with the Drive Activity API using the Google API Client Library for Java. In addition, you may be interested in the following documentation:
- Browse the JavaDoc reference for the Drive Activity API.
- Read the Developer's Guide for the Google API Client Library for Java.
- Interact with this API in your browser using the APIs Explorer for the Drive Activity API.
Add Library to Your Project
Select your build environment (Maven or Gradle) from the following tabs:
Add the following to your Add the following to your pom.xml
file:build.gradle
file:
Python
Using the Google APIs Client Library for Python currently requires that you download and install the Python source.
This page contains information about getting started with the Drive Activity API using the Google API Client Library for Python. In addition, you may be interested in the following documentation:
- Browse the PyDoc reference for the Drive Activity API.
- Read the Developer's guide for the Google API Client Library for Python.
- Interact with this API in your browser using the APIs Explorer for the Drive Activity API.
System requirements
-
Operating systems:
- Linux
- Mac OS X
- Windows
- Python 2.7, or 3.4 or higher
Installing the client library
You can either use a package manager or download and install the Python client library manually:
Managed installation
Use pip or setuptools to manage your installation (you might
need to run sudo
first):
- pip (preferred):
$ pip install --upgrade google-api-python-client
-
Setuptools:
Use the
easy_install
tool included in the setuptools package:$ easy_install --upgrade google-api-python-client
Manual installation
Download the latest client
library for Python, unpack the code, and run
python setup.py install
App Engine
Because the Python client libraries are not installed in the App Engine Python runtime environment, they must be vendored into your application just like third-party libraries.
To do that, run the following commands:
$ hg clone https://google-api-python-client.googlecode.com/hg/ google-api-python-client $ cd google-api-python-client $ sudo python setup.py install
You can now import the classes you will need using the following statements:
from apiclient.discovery import build from apiclient.oauth import OAuthCredentials import httplib2 import oauth2 as oauth
PHP
Using the Google APIs Client Library for PHP currently requires that you download and install the PHP source.
To do that, run the following commands:
$ svn checkout http://google-api-php-client.googlecode.com/svn/trunk/ google-api-php-client-read-only $ cd google-api-php-read-only $ # Copy the src directory to your working directory.
You can now import the classes you will need using the following statements:
require_once "../src/apiClient.php";
.NET
Using the Google APIs Client Library for .NET requires that you download the core .NET client library and the Google Drive Activity API .NET library. Download the files and add them as references to your project:
You can now import the classes you will need using the following statements:
using Google.Apis.Authentication; using Google.Apis.Authentication.OAuth2;