APIs —How a Newbie can Find a Decent (Free) One
What is an API?
Wikipedia says, “…Application Programming Interface (API) is a set of subroutine definitions, protocols, and tools for building application software.” Ok. Well, if you’re like me, the first time you read this you’re probably thinking, “what the heck does that mean?” Wikipedia is…well, Wikipedia. They definitely go deeper into their explanation if you want more details, but for now the main thing you need to know is this: APIs basically create the ability to interact with large amounts of data.
The definition of data has a pretty wide range, as does the possible level of interaction. If you can think of it, there’s probably an API out there manipulating the data to produce it. But what is “it”? That’s a pretty vague term. I know.
There are thousands of APIs out there. Facebook, Google, Yahoo, Flickr, Instagram, Twitter, and Wikipedia all have APIs. When one makes use of those APIs properly, the data within them can be accessed and manipulated for many many different possibilities. And I mean many. Like, think of a number. More than that.
How does your dentist send a link confirming your future appointments to your Google Calendar? Probably through an API.
Note that most APIs are not open source, meaning freely open to use. But the purpose of this article is to hopefully help other newbies play around with open APIs.
Take Flickr’s API for example:
“…anyone can write their own program to present public Flickr data (like photos, video, tags, profiles or groups) in new and different ways.”
All that info? Trust me though, there’s more.
Each photo is stored with its own unique information (user_id, tags, place_id, date_taken, latitude, longitude, etc.), which leads to a massive database wherein we can access this information. Here’s where the API comes in! APIs make it possible to sort through all this data for whatever you want. Want to see every photo with “park”, “landscape” and “waterfall” tags in a 20 mile radius of latitude 33.7489954 and longitude -84.3879824? Well, let me just put this code in and, what?! There it all is! It’s pretty cool.
We could dive deep into APIs, but I’m still a newbie. You should probably find a more legitimate source for that. However, I would be remiss if I didn’t share a few killer tips I’ve found while struggling to work with my first API.
How to Find a Decent API
Or at least how our group managed to find a usable, free API
- Use “developer” in your random Google searches.
Searching “API” in Google isn’t exactly specific, and will most likely yield a lot of results. I’ve found that adding “developer” to the search string, your results will be a much more narrow and germane to the task at hand. This will save you time not sorting between results pertaining to the American Petroleum Institute or the Academic Programs International. Both of which sound lovely, but not what we need here.
So, why does adding developer help? Because larger databases use dev/developer in their URL or search parameters. And it seems documentation within these websites will have developer in there because, you guessed it, developers use APIs.
2. Do your research before committing to an API
Of course you’re doing research. Google “Developer Google API” and you’re taken straight to their API database. But, what else do we need besides the code? Well, is it open source? Does their sandbox version have limitations or restrictions on how you can use their information? How many requests will you need to make a day?
When my classmates and I started searching, we decided to land on Instagram to be the focus of our project. And why not? We all love photography, we love Atlanta. So let’s find some beautiful photos!
How foolish we were. We were all VERY new to APIs. And even for an experienced coder, documentation can be incredibly lengthy — yes, even more lengthy than today’s blog post. As a newbie, it’s an incredibly daunting task to come up with an idea, find an API that matches your vision, find another or the same? API that actually has the info you want, then incorporate that API into your code and actually be able to USE what it has. So instead you skim a bit of this and bit of that, you get a key and you start coding.
2 hours pass. Not much progress. Until finally we stumbled upon a tutorial with Instagram’s API. Perfect! We were on our way to an incredible project!
Nope. Within this life-saving tutorial, are Instagram’s new policies where, as of June 2016, “without express written permission from Instagram, any API use is limited to your personal Instagram account and up to 10 other accounts.” And on top of that, only the last 20 posts. Welp…we’re just three lowly students with a simple project. We’re not getting access to their whole database.
3. How to Google Other Aspects During Your API Searches
What did we learn after Instagram’s policies killed our mood? Look for tutorials if you’re using APIs. There are a multitude of tutorials pertaining to certain APIs. Wanna know what the developer considered hiccups in the project? Want to see a sample of the code they used? How about knowing how they made the most of the information provided? It’s all in the tutorials. Also, looking into as many forums as possible. Your question has almost certainly been asked before. Look. It. Up.
4. Try, try, and try again
Being a newbie is difficult. Am I upset that we didn’t think to dive into Instagram’s lengthy policies beforehand? Yes. Do I really want all of that time back? Of course. Honestly, it pushed me to write this; now I can reference this later and remember what not to do. And maybe, just maybe, it could help someone else down the road.
Overall, the world of coding is massive. APIs are extensive. Getting what you need can be more difficult than using it. However, every 2 hours banging your head against your keyboard is two hours of taking the next step to becoming better. And learning what to look for can be invaluable.