com.google.api.client.googleapis.services
Class GoogleKeyInitializer

java.lang.Object
  extended by com.google.api.client.googleapis.services.GoogleKeyInitializer
All Implemented Interfaces:
JsonHttpRequestInitializer

public class GoogleKeyInitializer
extends Object
implements JsonHttpRequestInitializer

JSON HTTP request initializer that specifies a Google API key for all requests.

This is needed when doing unauthenticated access to Google APIs. Otherwise, you will only be able to make a small number of queries. When you exceed this limit, you will receive a "403 Forbidden" error with the message "Daily Limit Exceeded. Please sign up". See Unauthenticated access for more details.

Note that this is not needed when doing authenticated access with OAuth 2.0, because the OAuth 2.0 client ID is already associated with the same project as the API key.

Since:
1.8
Author:
Yaniv Inbar

Constructor Summary
GoogleKeyInitializer(String key)
           
 
Method Summary
 void initialize(JsonHttpRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoogleKeyInitializer

public GoogleKeyInitializer(String key)
Parameters:
key - API key
Method Detail

initialize

public void initialize(JsonHttpRequest request)
Specified by:
initialize in interface JsonHttpRequestInitializer


Copyright © 2010-2012 Google. All Rights Reserved.