Want a REST API to play with?

Are you just starting out with REST APIs, or curious what they look like, and want one that’s easy to play with? Have a go at this tutorial I’ve just written for the Google Maps Engine API: Putting your data on a map.

A few things make it easy to play with the API via the tutorial:

  • You can get started immediately. All you need are a project on the Google APIs Console and a Google Maps Engine account, both of which are freely available. The instructions are in the tutorial.
  • The API accepts requests via an online interface called the Google APIs Explorer. So, instead of having to send HTTP requests and parse responses via the command line or within a program, you can just use an online form. The APIs Explorer prompts you for the fields and parameters that are required for each API request. I’ve integrated the APIs Explorer into the tutorial, so each step of the tutorial offers a link to the appropriate form in the APIs Explorer.
  • If you use the APIs Explorer, you can skip the bit about OAuth and client IDs. Yaayyy for a touch of simplicity when first getting to know an API!
  • The tutorial includes the full HTTP URL and request body for each API request. For those into Java, there are Java code snippets and a downloadable sample app.
  • After performing each step of the tutorial, you get visual confirmation of results. So, you’ll follow instructions to send a request via the API, then you’ll look at your account in Google Maps Engine online to see what’s changed.

More about Google Maps Engine, its web interface, and the API

Google Maps Engine provides a means to store geographic data in the Cloud, and to superimpose that data on top of the Google base map. Geographic data can be vector or raster. In the tutorial, you’ll use vector data consisting of a set of geographic points (latitudes and longitudes) with the associated information that you want to represent on a map (in this case, population growth statistics).

Google Maps Engine offers a web UI (user interface) where you can upload data and customise your map. It also offers an API (application programming interface), so that you can upload and manipulate your data programmatically. This particular API is a REST API, which means that it accepts requests and sends responses via HTTP. The requests and responses use JSON format to represent and transfer data.

When following the steps in the tutorial, you’ll use the API to do something, such as upload a set of vector data, and then you’ll look at the UI to see the results.

What you’ll have achieved by the end of the tutorial

When you’ve finished the tutorial, you’ll have your very own interactive map in Google Maps Engine, looking like the screenshot below. The circles show population growth (blue circles) or decline (red circles) in countries around the world. The size of the circle represents the size of the change:

Screenshot of map

Let me know if you try it

I’d love to know how you get on with the tutorial, and what you think of the API. Here’s the link again: Tutorial 1: Putting your Data on a Map.

How to track textual input with Google Analytics

This week an analytics ninja showed me how to use Google Analytics to track the values entered into a text field. It comes down to sending a dummy page name to Google Analytics, containing the value entered into the field. Google Analytics faithfully records a “page view” for that value, which you can then see in the analytics reports in the same way that you can see any other page view. Magic.

For example, let’s say you have a search box on a documentation page, allowing readers to search a subset of the documentation.  It would be nice to track the most popular search terms entered into that field, as an indication of what most readers are interested in. If people are searching for something that is already documented, you might consider restructuring the documentation to give more prominence to that topic. And how about the terms that people enter into the search box without finding a match? The unmatched terms might indicate a gap in the documentation, or even give a clue to functionality that would be a popular addition to the product itself.

It turns out that you can track input values via Google Analytics. The trick is to make a special call to Google Analytics, triggered when the input field loses focus (onblur).

<input onblur="ga('send', 'pageview', 'my-page-name?myParam=' + this.value);" />

The above ga call sends a customised page view to Google Analytics, passing a made-up page name that you can track separately from the page on which the input field occurs. The made-up page name is a concatenation of a string ('my-page-name?myParam=') plus the value typed into the input field (this.value).

The string my-page-name can contain any value you like. It’s handy to use the title of the page on which the input box occurs, because then you can see all the page views in the same area of Google Analytics.

Similarly, the part that contains the input text can have any structure you like. For example, if the page is called “Overview” and the input field is a search box, the Google Analytics call could look like this:

<input onblur="ga('send', 'pageview', 'overview?searchText=' + this.value);" />

This blog post assumes you have already set up Google Analytics for your site. See the Google Analytics setup guide. The Google Analytics documentation on page tracking describes the syntax of the above “ga” call, part of “analytics.js”.

Follow-up on yesterday’s talk about API technical writing

Yesterday I was privileged and delighted to speak at a meeting of the STC Silicon Valley Chapter in Santa Clara. Thanks so much to Tom Johnson and David Hovey for organising the meeting, and thank you too to all the attendees. It was a lovely experience, with a warm, enthusiastic and inspiring audience. This post includes some links for people who’d like to continue playing with the APIs we saw last night and delving deeper into the world of API documentation.

The presentation is on SlideShare: API Technical Writing: What, Why and How. (Note that last night’s presentation didn’t include slide 51.) The slides include a number of links to further information.

The presentation is a technical writer’s introduction to APIs (Application Programming Interfaces) and to the world of API documentation. I hope it’s useful to writers who’ve had very little exposure to APIs, as well as to those who’ve played with APIs a bit and want to learn about the life of an API technical writer.

Overview

Here’s a summary of the presentation:

  • Introduction to the role of API technical writer.
  • Overview of the types of developer products we may be asked to document, including APIs (application programming interfaces), SDKs (software development kits), and other developer frameworks.
  • What an API is and who uses them.
  • Examples of APIs that are easy to play with: Flickr, Google Maps JavaScript API
  • Types of API (including Web APIs like REST or SOAP, and library-based APIs like JavaScript or Java classes).
  • A day in the life of an API technical writer—what we do, in detail.
  • Examples of good and popular API documentation.
  • The components of API documentation.
  • Useful tools.
  • How to become an API tech writer—tips on getting started.

Demo of the Flickr API

During the session, I did a live demo of the Flickr API. If you’d like to play with this API yourself, take a look at the Flickr Developer Guide (and later the Flickr API reference documentation). You’ll need a Flickr API key, which is quick and easy to get. Slide 23 in my presentation shows the URL for a simple request to the Flickr API.

Demo of the Google Maps JavaScript API

My second demo showed an interactive Google map, embedded into a web page with just a few lines of HTML, CSS and JavaScript. I used the Google Maps JavaScript API. If you’d like to try it yourself, follow the getting started guide in Google’s documentation. You’re welcome to start by copying my code. It’s on Bitbucket: HelloMaps.HTML. That code is what you’ll find on slide 28 in the presentation.

More links

There are more links to follow in the presentation itself: API Technical Writing: What, Why and How. I hope you enjoy playing with some APIs and learning about the life of an API technical writer!

Talk about API technical writing in Silicon Valley next Monday

I’ll be speaking at the meeting of the STC Silicon Valley Chapter in Santa Clara on Monday 25th August. Thanks to Tom Johnson for organising this get-together! I’m excited to meet the Silicon Valley writers. 

The talk is titled, “API Technical Writing: What, Why, and How“. The meeting announcement has the details.

Have you ever wondered what API technical writers do, and how they go about it? Perhaps you’d like to move into developer-focused documentation yourself, and need some tips on getting started.

Join us to discuss what an API is and poke some easy-to-use APIs that you can play with later yourself. Examine examples of API documentation, pick up a few useful tools, and grab some ideas on getting started in this field. It’s an exciting and rewarding area of technical communication.

Date and time:

August 25th, at 6pm for socialising. The talk starts at around 7pm.

Location: 

IHOP Restaurant
4200 Great America Parkway
Santa Clara, CA 95054-1210
408-980 8887

Lunch-time talk on API technical writing

I’ll be speaking at the lunchtime meeting of the Sydney CBD Technical Writers’ Group on Wednesday 6th August. This group is led by Bede Sunter on behalf of the Australian Society for Technical Communication NSW. The session is free of charge, and open to all. You’re invited! (Please bring your own lunch.)

The talk is titled, “API Technical Writing: What, Why, and How“.

Have you ever wondered what API technical writers do, and how they go about it? Perhaps you’d like to move into developer-focused documentation yourself, and need some tips on getting started.

Join us to discuss what an API is and poke some easy-to-use APIs that you can play with later yourself. Examine examples of API documentation, pick up a few useful tools, and grab some ideas on getting started in this field. It’s an exciting and rewarding area of technical communication.

Date and time: Wednesday 6 August, from 12:30 to 1:30.

Location: 

Level 21, HSBC Building
580 George Street – close to Town Hall Station
Sydney, Australia
Map: http://goo.gl/maps/7UdRH
Offices of TP3 Group
Ask at reception on level 21 for the room number

RSVP: Please add a comment to this page if you’re coming, so that we know how many people to expect over and above the usual crowd. :)

Follow

Get every new post delivered to your Inbox.

Join 1,489 other followers

%d bloggers like this: