The Google Prediction API is built on HTTP and JSON, so any standard HTTP client can send requests to it and parse the responses.
However, the Google APIs client libraries provide better language integration, improved security, and support for making calls that require user authorization. The client libraries are available in a number of programming languages; by using them you can avoid the need to manually set up HTTP requests and parse the responses.
Go
Get the latest Google Prediction API client library for Go (alpha) .
Read the client library's developer's guide .
Java
This page contains information about getting started with the Prediction API using the Google APIs Client Library for Java. In addition, you may be interested in the following documentation:
The
prediction-cmdline-sample
may help you get started using the client library.
Select your build environment (Maven or Gradle) from the following tabs, or download a zip file containing all of the jars you need:
Download the Prediction API v1.6 Client Library for Java
.
See the
The
Add the following to your
See
all versions available on the Maven Central Repository
.
Add the following to your
See
all versions available on the Maven Central Repository
.
Sample
Add Library to Your Project
prediction/readme.html
file for details on:
libs
folder contains all the of the globally-applicable dependencies you might need across all application types.
pom.xml
file:
build.gradle
file:
JavaScript
Read the client library's developer's guide .
.NET
This page contains information about getting started with the Prediction API using the Google APIs Client Library for .NET. In addition, you may be interested in the following documentation:
Install a NuGet package from those available at
Google.Apis.prediction
.
Downloading the library
Node.js
Get the latest Google Prediction API client library for Node.js .
Read the client library's developer's guide .
Objective-C
Get the latest Google Prediction API client library for Objective-C .
Read the client library's developer's guide .
PHP
Get the latest Google Prediction API client library for PHP (beta) .
Read the client library's developer's guide .
Python
This page contains information about getting started with the Prediction API using the Google APIs Client Library for Python. In addition, you may be interested in the following documentation:
Note
: This library is pure Python, so other operating systems with Python support may work as well.
To install the library and all of its dependencies,
open a terminal and do one of the following:
Depending on your system, you may need to prepend those commands with
Because
Google App Engine
requires that all of the source files for a library must be present in your App
Engine project, there is a special installation procedure for App Engine. To
install the library and all of its dependencies in an App Engine project,
download the file named
System requirements
Manual Installation
easy_install
tool included in the setuptools package:
$ easy_install --upgrade google-api-python-client
$ pip install --upgrade google-api-python-client
sudo
.
App Engine
google-api-python-client-gae-
N.M
.zip
from the
list
of downloads
, where
N.M
is the version number of the latest release. Unzip
that file into your project. For example:
$ cd myproject
$ unzip google-api-python-client-gae-1.1.zip
Ruby
This page contains information about getting started with the Prediction API using the Google APIs Client Library for Ruby. In addition, you may be interested in the following documentation:
The
prediction
sample may help you get started using the client library.
If you haven't installed the Google APIs Client Library for Ruby before, open a terminal and install using
Sample
Installing the google-api-client gem
RubyGems
:
$ gem install google-api-client
If you already have the gem installed and would simply like to update to the latest version:
$ gem update -y google-api-client
Depending on your system, you may need to prepend these commands with
sudo
.
Getting started with the Google APIs Client Library for Ruby
Be sure to check our extensive Getting started guide for a quick overview of how to make your first request.
Other ways to access the Google Prediction API
The table below lists some other convenient ways to access the Google Prediction API.
Access method | Description |
---|---|
APIs Explorer | An interactive tool that lets you easily try out Google APIs right from your browser. |
Google Plugin for Eclipse | A plugin that makes it easier to use Google APIs in Eclipse. |
Here are additional ways to access the Prediction API:
Access Method | Description |
---|---|
Apps Script | A JavaScript cloud scripting language that makes it easy to automate tasks across Google products and third party services. See the sample Google Spreadsheet that uses Apps Script to call the Prediction API for more details. |
Google Prediction Client Library for R | A client library that lets you use the Google Prediction API with the R language. |
Sample: Calling Prediction API from App Engine
Quick example
A quick example of calling Prediction API from App Engine .Full sample application
Google offers a featured sample application that includes all of the code required to exercise the Google Prediction API in a scalable web service hosted on Google App Engine . The featured application is called "Try-Prediction" and is available in Java and Python. Included in the featured app is a complete implementation of server-side shared OAuth 2.0 authentication/authorization credentials.
The source code and documentation for this application are available at Try Prediction .
You can also experiment with "Try Prediction" interactively at http://try-prediction.appspot.com .
Access Prediction with App Engine service accounts
Use a pre-trained, publicly hosted predictive model and train your own predictive model, using an App Engine Service Account for easy authentication. Building on the Python version of the App Engine Guestbook application from the App Engine Getting Started Guide , which allows users to post messages, you can add the Prediction API to classify each message as having a positive or negative sentiment, first using a publicly hosted model and then, with a language identifier (for English, Spanish, or French), using a model that you will train using sample data.
For more information, read the article on accessing App Engine service accounts with the Prediction API.