Let's imagine for a moment you’re craving sushi. You need a spicy tuna roll right now or you’re going to be upset for the rest of the day (if you don’t like sushi, think of something else).
So what do you do? You hop in your car and drive to the nearest sushi restaurant. When you get there, you sit down and tell the waiter exactly what you want. The waiter then takes your request back to the kitchen, the chef makes you the perfect spicy tuna roll, and the waiter brings it out to you.
In this case you don’t need to know exactly how to make the perfect sushi roll or worry about inventory, food safety, or anything that happens behind the scenes – you just ask for a sushi roll and the waiter brings it to you.
Think of an API like a waiter at a restaurant.
An API (Application Programming Interface) is a set of rules used by different operating systems to communicate with one another. In other words, APIs control the flow of information between different platforms and make life much easier for developers.
Chances are, you interact with APIs every day and never notice. APIs are baked into millions of platforms and apps across the internet from Uber and Lyft, to Tinder and Bumble, Gmail, Pokemon Go, and more.
Here's how an API works:
Let’s say you want to build an app that notifies users whenever cute puppies are nearby. Instead of having to create your own map software, you can just build your app using Google’s existing Maps API which saves a tremendous amount of development resources, time, and money.
The best part is, APIs work behind the scenes, so users have no idea they are even using them.
When a user wants to find out where all the cute puppies are nearby, they open your PupFinder app, which sends a request to the Google Maps API to find their location.
Once the Google Maps API has a user’s location, it sends that data back to PupFinder, which also knows the location of all users that have registered their cute puppies in the app.
Now on their screen, the user sees their location along with the locations of cute dogs in the area. Woof!
Now let’s talk about how you actually get the data from an API:
What is JSON?
No, JSON is not the guy who lives in the apartment below you who plays music too loud on a Tuesday night, that’s Jason.
JSON breaks down the interaction between an API and another platform into a simple call and response format. JSON starts with a question: “zip code”. To us this would be like asking, “What is the zip code of this place?” It then displays the response from the API: “95108” – “the zip code of this place is 95108”.
Here’s what a sample JSON schema looks like:
We can break down every one of these call and response fields as a question.
- Question: “company” → “What company is this?”
Response: “Twitter Inc.” → “This is Twitter.”
- Question: “pageviews” → “How many pages did they view”
Response: “1” → “They viewed 1 page.”
And so on. Basically, one platform asks a question, the API answers, and JSON makes it easy to read, understand, and use.
APIs are a cornerstone of the modern internet. They provide a solid foundation for the millions of apps, services, and websites we depend on every day. When we combine powerful APIs with JSON’s usability, we have a very robust combination allowing developers to easily integrate today’s best technologies into their own, thereby paving the way for the next generation of software platforms.
To learn more about how you can integrate KickFire’s business intelligence into your technology, check out our KickFire API for Developers Hub.