CODEX
Web Dev Bytes — Happy with API’s
There’s valuable data out there, here’s how to get it!
When I was getting started in tech, by far the biggest obstacle I faced was that I didn’t have any foundational knowledge in how the internet works. These articles are my way of giving back, to any aspiring web developers or knowledge seekers looking to broaden their horizons.
I am still haunted by a task from my first tech job. My manager asked me to do some research on “mapping API’s” so she could cost-compare the options. I was a product management intern with no idea what she meant, so of course I said “Yes” and hit Google, hard. I think it took me three days before I gave up and asked for help, and I still didn’t know what an API was! So this is the article I wish I’d found back then: I’m going to break down what the heck an API is.
Taking Control
Like so many web dev concepts, an Application Programming Interface sounds technically complex but is actually pretty easy to understand. An API (pronounced ay-pee-eye) is simply the collection of functions you can use to work with a piece of software. Imagine an application as a big metal box with knobs and levers on the outside. The outside controls (API functions) let you use the box (application) even though you can’t see what’s going on inside.
Web API’s are very common, and even non-programmers may be expected to interact with them (as was the case during my internship). the usual setup is that there’s a server whose API you use via URL’s. Using those API’s could trigger actions like placing an order, but it almost always returns data.
Finding krefsar
Because they use URL’s, it’s super easy to see an API in action using a web browser. For example, my Github username is “krefsar”, so try going to the Github API with my username at api.github.com/users/krefsar
:
You just made an API call using the browser. Check out all that data about me! You could even use that data to power an application!
Dollars for Data
Data can be valuable. If you build an API that lets people access useful data, then you could even charge them to use it! All you’d need to do is give each paying customer a unique API key to use whenever they access the API. Then you could track their usage and bill them accordingly. For example, you can pay to access Google Maps’ Directions API so that you can use their pathfinding engine in your own application.
That Was Easy!
Not too bad right? An API is just describing the publicly accessible ways you can use software, in contrast to the hidden, behind-the-scenes things the software might be doing. To take it back to my original mapping API task, my manager was asking me to find API’s that allowed access to mapping data. Since mapping data is valuable, I should have been searching for companies that were selling that data, and gathering info on things like price and ease of use.
Try exploring on the internet. If there’s data, chances are there’s an API to access it. Until next time, here are some free API’s you can play with:
- Cat Facts — https://alexwohlbruck.github.io/cat-facts/docs/
- Random Dogs — https://random.dog/woof.json
- Agify — https://api.agify.io?name=evan
- Open Air Quality — https://api.openaq.org/beta/averages