This article is part of the She Hacks Academy (a hackathon training program for women, by women) where we write about different topics that might help other women participate and thrive in hackathons.
When I went to my first hackathon in 2009 I had no idea what an API was. I remember walking into the room, hoping I would learn something new and meet some great people. I found out that an API is an application programming interface, it’s a way to communicate between your own server and another server to get or send data from it.
Why would you want to communicate with another server?
At that hackathon I learned that there are thousands of companies and startups all over the world who have created APIs to give developers access to their data. An API allows you to send or receive data from another server. Using an API is a fantastic way to save time and money, you do not need to build everything from scratch.
An API is like the menu at a cafe. Imagine you are going out for brunch with friends. You sit down and take a look at the menu, it has 15 different items on it. You decide to choose the poached eggs on toast with a coffee. Next you need to place your order, this is like when you write code to call an API. The food you ordered then arrives at your table. The food is the response from the system you have called using the API.
Let’s have a look at one of the first mashups I created using APIs.
I wanted to create an app for the 2010 App My State competition which would use the Google Maps API. I looked at the API to understand what services I could use within my application. I decided to load a map and add pins with info windows. I also used the Google Calendar API to allow users to save events to their own calendars.
What would life be like without APIs?
If I did not use Google APIs to create Event Now, I would have had to write my own maps and calendar applications from scratch. Because I used APIs I was able to have an idea, and build it within a few hours.
What is an example of API use at She Hacks?
The She Hacks winning team, Garage Sales Map, used the Google Maps API to create an minimum viable product (MVP) in less than 24 hours. The developers in the team, Bei and AJ, displayed the map, loaded pins onto the map to showcase where garage sales were happening. They also gave users the ability to add their own garage sales to the map using pins.
How to create an app that uses the Google Maps API
You can create your own web page that uses the Google Maps API to display a location in a few minutes by following these steps. The location this map will load on is Inspire9, the co-working space used for She Hacks Melbourne 2014.
- Before you can use the Google Maps API you will need to obtain your own personal API keys. These keys are used by Google to track how you use the API. To create your keys you will need to login to https://code.google.com/apis/console, click on Services and then activate Google Maps API v3. Click on the API Access link in the navigation bar and find your Simple API keys.
- Create a HTML page, use the example code below and replace API_KEY with your Simple API key and change SET_TO_TRUE_OR_FALSE to true or false. Setting the sensor to true allows you to determine the user’s location.
Google Maps API Code Example
Here is the code example that you can use to create your HTML page that calls the Google Maps API. It will load on Inspire9, if you would like to change where the map loads you only need to make a small change. First visit http://www.latlong.net/ and enter an address into the Place field. Use the Lat Long figures it returns instead of the Lat Long figures for Inspire (-37.763785, 144.967167).
Next Action Steps
Now you know what an API is, your challenge is to identify one example of an app you like that uses an API. Reply to the note next to this paragraph with your answer. Not sure where to start looking? Head over to http://www.programmableweb.com/apis/directory/1?sort=mashups
If you create a web page that uses an API I would love to see it, send a link to me on Twitter @tammybutow and I will post it here.
Continue to the She Hacks Academy collection for more articles related to participating and enjoying a hackathon.