Working with APIs
How it works
• You provide a URL which contains a description of the
map you want.
• How do you know how to write this description? Only
by reading Google's documentation for the Static Maps
• After perusing the instructions, you learn that Google
wants a URL in this format:
• Visit that URL with your browser to see the map
Google draws for you.
What it means
– This is the endpoint of the API, the base address of the service.
Think of it as the location of the remote script that will be
reading your input and responding back.
– This is a delimiter that separates the endpoint from the
parameters that you use to specify the details of your request.
– The parameters you pass in will be in key-value pairs. The key is
the name of the property, such as size. The equals sign = is how
you specify the value (e.g. 300x200) for the key.
– Each parameter key-value pair is delimited by an ampersand
– This can either be true or false and indicates whether or
not the browser is keeping track of the user's geo-location.
For our purposes, we leave it to false.
– This specifies the widthxheight dimensions of the map
image that we would like.
– This specifies the address in which we want the map image
to focus around. The + sign denotes a space character in
the URL (this is true across all Web addresses, not just this
• Using the Google Statics Map API, what are
the HTTP calls needed to generate the
– 400 pixels wide and 250 pixels high
– At a zoom level of 4
– Includes a green marker at 100 Wall Street, NY
and a blue marker at 100 Main St. Queens, NY; has
a zoom level of 9; and is 500x350
• Requires an OAUTH key
• Must have a twitter account
• Must create a twitter app
• Show example
• Easiest I have found
• Shared key
– Register once and play with different APIs
– Good for exploration
• Google Driving Directions
• Interactive Yoda Speak
• Explore Mashape APIs and use one in a Ruby