Sie sind auf Seite 1von 19

Google APIs

Why Aren’t You Using Them?

Jeff Blankenburg
Project Engineer
Quick Solutions, Inc.

jblankenburg@quicksolutions.com
http://blog.jexed.com
All of the APIs can be found at http://code.google.com

Site Maps
Checkout
Account Authentication Earth

Blogger
Picasa AdSense

Search History
Spreadsheets
Groups
Gadgets
YouTube
AdWords
Calendar

Maps Talk
Search

Currently Available APIs


Google Maps requires an API key to work.

Keys are freely available at:


◦ http://www.google.com/apis/maps/

Key is referenced in a JavaScript include


file that must live on every page.

Google Maps API


It takes two lines of code to get a Google map on your page.

var map = new GMap2(document.getElementById("map"));


map.setCenter(new GLatLng(40.146212, -82.994824), 13);

Launch

Google Maps API


A few more lines results in maps controls for zoom and pan.

var map = new GMap2(document.getElementById("map"));


var point = new GLatLng(40.146212, -82.994824);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());
map.setCenter(point, 13);

Launch

Google Maps API


You can also add events to almost anything on the map.

var map = new GMap2(document.getElementById("map"));


var point = new GLatLng(40.146212, -82.994824);
GEvent.addListener(map, "moveend",
function() {
var center = map.getCenter();
alert("MAP CENTER: \n" + center.toString());});
GEvent.addListener(map, "mouseout“,
function() {
alert(“You’re done dragging?");});
map.setCenter(point, 13);

Launch

Google Maps API


All of this stuff is great, but what if you
don’t know your latitude and longitude?

var address = "8850 S. Old St. Rd., Columbus, OH 43240";


var map = new GMap2(document.getElementById("map"));
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address,
function(point){
if (point){map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);}});

Launch

Google Maps API


There’s plenty you can do with these maps,
it just takes a little imagination.

Goggles Red Light


BigBoxWatch
Flight Sim Cameras

U.S. Project My Sample


Breweries Management Demo

Google Maps API


Google Checkout is complete e-commerce service.

There are 3 levels of integration:

• Easy (creating checkout buttons)

• Medium (creating a form dynamically and posting it)

• Hard (creating web services for a back-and-forth


transactional model that can be nearly transparent.)

Seller Site Buyer Site

Google Checkout API


 Once you have a Checkout Merchant ID (2-3 days), you
can create buttons to put on your site.

 You write no real code, but end up with no real


functionality. Just basic “Buy Now” buttons.

 You can sell one product at a time, with no shopping cart


functionality.

Google Checkout API - Easy


<form
action="https://sandbox.google.com/checkout/cws/v2/Merchant/352649253823257/checko
ut" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm">

<img class="product" src=http://static.flickr.com/24/66271103_ae0b3385ec.jpg


border="1"/>

<input name="cart" type="hidden" value=“HEXKEY"/>

<input name="signature" type="hidden“ value="cffcsirw+mn/KGCPZ96tcR7UYMM="/>

<input alt=""
src="https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=3526492538232
57&amp;w=117&amp;h=48&amp;style=white&amp;variant=text&amp;loc=en_US"
type="image"/>
</form>

Launch

Google Checkout API - Easy


You can create an HTML form on the fly
for the user’s cart.

Post it to the Google server, where the


user logs in, and pays there.

Actually
pretty robust, good for most
merchants.

Launch

Google Checkout API - Medium


<form method="POST" action="https://sandbox.google.com/checkout/cws/v2/Merchant/352649253823257/checkoutForm"
accept-charset="utf-8">
<input type="hidden" name="item_name_1" value="Chunky Peanut Butter"/>
<input type="hidden" name="item_description_1" value="Chunky peanut butter."/>
<input type="hidden" name="item_quantity_1" value="6"/>
<input type="hidden" name="item_price_1" value="3.75"/>
<input type="hidden" name="item_name_2" value="Creamy Peanut Butter"/>
<input type="hidden" name="item_description_2" value="Creamy peanut butter."/>
<input type="hidden" name="item_quantity_2" value="2"/>
<input type="hidden" name="item_price_2" value="3.50"/>

<input type="hidden" name="ship_method_name_4" value="In-store Pickup"/>


<input type="hidden" name="ship_method_price_4" value="0"/>
<input type="hidden" name="ship_method_name_1" value="Carrier Pidgeon"/>
<input type="hidden" name="ship_method_price_1" value="1.50"/>
<input type="hidden" name="ship_method_name_2" value="UPS Ground"/>
<input type="hidden" name="ship_method_price_2" value="10.99"/>
<input type="hidden" name="ship_method_name_3" value="Teleporter"/>
<input type="hidden" name="ship_method_price_3" value="24.99"/>

<input type="hidden" name="tax_rate" value="0.0875"/>


<input type="hidden" name="tax_us_state" value="NY"/>

<input type="image" name="Google Checkout" alt="Fast checkout through Google"


src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=352649253823257&w=180&h=46&style=whit
e&variant=text&loc=en_US" height="46" width="180"/>
</form>

Launch

Google Checkout API - Medium


 Everything is done via a set of XML web services.

 You can update your systems (shipping status, etc), and


Google’s interface will represent that data as well.

 Incredibly robust, and ties in well with many existing


shopping cart offerings.

 http://code.google.com/apis/checkout/

 Sample Code

 The Hard implementation probably deserves its own


presentation, in a specific language.

Google Checkout API - Hard


Some examples of Google Checkout implementations.

buy.com toysrus.com starbucks.com

Master List of Google Checkout Vendors

Google Checkout Examples


 Calendar APIs are still in their infancy.

 You can access a Google Calendar either via a


pre-formatted <iframe> element, or by directly
accessing the XML feed.

 By directly tying into the API, you can also post


events back to a calendar for adds and updates.

 Allthe API documentation is presented only in


Java, currently, but should translate well to .NET.

Google Calendar API


This is an example of a Google Calendar XML file.

<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005‘>


<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2005#event'></category>
<title type='text'>Tennis with Beth</title>
<content type='text'>Meet for a quick lesson.</content>
<author>
<name>Jo March</name>
<email>jo@gmail.com</email>
</author>
<gd:transparency value='http://schemas.google.com/g/2005#event.opaque'> </gd:transparency>
<gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'>
</gd:eventStatus>
<gd:where valueString='Rolling Lawn Courts'></gd:where>
<gd:when startTime='2006-04-17T15:00:00.000Z' endTime='2006-04-17T17:00:00.000Z'>
</gd:when>
</entry>

Google Calendar XML File


You can keep your data in your calendar,
and expose it to your audience.

Google Google
Google
Calendar using Calendar as an
Calendar
the API XML file

Google Calendar Implementation


Google APIs…
They’re so easy even a caveman could do it.

 JeffBlankenburg
 Project Engineer, Quick Solutions
 jblankenburg@quicksolutions.com
 (614) 327-5066

Google APIs – Questions?

Das könnte Ihnen auch gefallen