Learning about APIs
When I first started my coding journey I had very little knowledge about a lot of things. When I got into school there was a lot of technical jargon thrown around that made my head spin. (and still does) But with anything, the more you dive deeper into a subject the more you learn AND the more you realize what you don’t know.
Todays’ subject is something called an API. If you haven’t guessed yet, it’s an acronym that stands for Application Programming Interface.
All in all, it’s just a really fancy way of saying what one web application shares with another.
For my project I had to build my own API which was not as intimidating as one might think once you actually get into it.
My hope is to explain an API in a way that will make you want to create your own and maybe make you a bit hungry afterwards.
The best way to explain an API would be thinking about a pizzeria! 😋😋
And for the sake of this example we will call this Elle’s Pizzeria Pie Planet.
As you can imagine, You’re hungry and you walk into this awesome pizzeria!
As your mouth waters from the aroma wafting about you, your mind races as it thinks of the hundreds of pizza options to choose from.
You are a civilized human- being, so you wait for your hostess to seat you.
They hand you a menu to look at and THERE is where you see all of the possibilities of pizza-making that Elle’s Pizzeria Pie Planet has to offer.
API’s are a lot like menus. Based on the API you chose, there will be a “menu” of things to choose from you that you can use in your application that you are building.
(Back to the pizza analogy)
After you have browsed the menu you are now free to place your order (based on what was on the menu) with your waiter. The waiter will tell the Chef and the Chef will whip something up for you and serve it to you.
An API will function in a similar manner. Once you tell the API the data or information you would like from it, it will return/ serve it to you.
another non- food example would be you want to see what the weather will be like in California on Wednesday. Using a weather app, it takes your request, interacts with the API, and will return to you the weather specifically on Wednesday in specifically California. (Since that’s what you requested)
Almost every app we use has an API behind it feeding us the data that we want/need to serve those who will be using our apps.
So for my project I created a Star Wars themed RESTful API to for my app that I created (the app will remain unnamed/ un-described).
This API will contain data about Star Wars that other would-be app creators can use for their own projects as well.(at some point)
Creating your own API is a cakewalk. For my project requirements I was able to create my API in rails using “seeded” data.
For more information on ways to make your own API to share with the world here are a few helpful links.