What’s an API and how to use one

Jamon Dixon
4 min readMay 5, 2021

--

Part 1 of 2

When I first started coding I was lost in a lot of the terminology that gets thrown around the world of computing. API was definitely one of those terms for me, so if you are feeling the same way don’t be ashamed. It is an acronym that stands for application programming interface. Essentially, it is an easy way to access mounds of data from an outside source who has already done the work of putting it all together in an easy to understand format. Pulling data from these APIs can provide some much needed functionality to an otherwise boring or lackluster application.

A good way to illustrate this concept is to take a step back and look at how the internet works. In general, the internet is one big web of interconnected servers. Remote servers hold data that can then be translated into pages that can be seen and understood by humans on the web. Every page you view on the internet is stored on a server somewhere. You can even start up a server on your on computer that is capable of serving a website. We would call this a local server and is how software engineers create and test apps or web pages before going into production. The client, or browser, makes a request to a website like google.com and the servers that store Google’s data then send back a response to the client in HTML. The actual data is stored in binary which would not be useful to us humans. Anytime this process happens you are interacting with a server’s API.

Another way an API is used can be to packaged them up as a service. Take Google maps for instance. One can sign up for an api key and be able to access the data that their application collects. You might ask, “How might that help me?” Well, it can be useful to create your own geocoding app that could map out the location of your friends and contacts. Or you could use that data to make an application to pinpoint all your favorite fishing holes, to make them easier to locate and come back to in the future. The possibilities are only limited to your own imagination.

The amount of APIs out there are endless. Data being one of the most valuable commodities these days, there are no shortage of them. However they do vary in price. Some can be completely free and I recommend trying to play around with those if you are inexperienced. A list of free public APIs can be found at https://github.com/public-apis/public-apis. This is a great starter pack and has a vast array of topics and subjects suitable to get an app off the ground. Below is a photo of the different ones available just pertaining to animals.

The prices of others may vary depending on the type of data you are getting and the amount of data. Also, many of them have a limit to a certain amount of queries you can send in a given amount of time. Meaning they will either start changing you after you hit that quota or just shut off access all together.

When it comes to hitting these third-party libraries of information, a specific URL, or endpoint, is given to access the info. It is almost always in the form of JSON, which basically standardizes the process and makes it consistent across all APIs. The data will then be structured as a bunch of key/value pairs to make it easy to pull out the specific data that you want.

I hope this conveys broadly what an API is and what it can be used for. In part 2 of this series I will dive into it more deeply and show specifically how to code out a fetch call from an outside api and what one could do with that data. Thanks for reading and feel free to connect through my LinkedIn or Github!

--

--

Jamon Dixon
Jamon Dixon

No responses yet