2 Quick Start

Let’s say you simply want to use one of the Google web services.

1. If you don’t already have one, get an API key from Google’s API Console.

2. Put your Google API key in a .google-api-key file in your home directory (On Unix and OS X: ~/.google-api-key.)

3. Find the name of the discovery document corresponding to the service you want to use; see Available services. For example, you want to use the goo.gl URL shortener service, and find that its name is urlshortener.v1.js.

4. Use require-gapi-doc to define Racket functions. For instance:

#lang racket
(require (planet gh/gapi/macro))
(require-gapi-doc urlshortener.v1.js)

5. Use the resulting functions to make requests to the service.

For example:

;; Use goo.gl to make a short URI
(define js (urlshortener-url-insert #:longUrl "http://www.racket-lang.org/"))
(dict-ref js 'id)

In this example, the urlshortener-url-insert procedure was defined when you did (require-gapi-doc urlshortener.v1.js) in step 4.

You can find documentation of the functions defined for each service using the links provided in Available services.

In general the web services will return JSON which is parsed and returned to you as a jsexpr? via the Racket json collection.