My favorites | English | Sign in

Google Base Data API (Labs)

JavaScript Interactive API Demo

The Interactive API Demo is written in JavaScript. The HTTP requests and responses that appear when you run the demo provide good examples of the requests and responses your application needs to handle.

Using the Interactive API Demo

You can run the Interactive API Demo directly from this site. It is fairly self-explanatory.

Stepping through the demo code

The primary implementation files are demo.js and httpRequest.js.

The following function constructs a Request header, including the AuthSub token and the developer key.

function constructRequestHeaders(token) {
	var headers = new Array(); 
	headers["Content-Type"] = "application/atom+xml";   
	headers["Authorization"] = 'AuthSub token="' + token + '"';   
	headers["X-Google-Key"] = 'key=ABQIAAAA7VerLsOcLuBYXR7vZI2NjhTRERdeAiwZ9EeJWta3L_JZVS0bOBRIFbhTrQjhHE52fqjZvfabYYyn6A';   
	return headers; 
}