The easiest way to think about what an API is to use a restaurant analogy. Everything that is available on the menu of the restaurant would essentially be the public API. 2 main gotchas to make the analogy work:
- the restaurant is giving out the food for free
- you can use the food to start your own little eatery.
Almost all cloud based services offers some form of public API. Heck, even governments have API’s.
Why is an public API important? API’s allow developers to build applications that consume resources from the service. More applications using data from the service generally results in greater usage. There comes a tipping point when enough network effect is created such that critical mass is achieved on the platform. Creating a platform where a network of applications can thrive in is the de-facto billion dollar goto growth strategy. However, always be wary when you’re building on someone else’s platform.
There are also private API’s or undocumented API’s that are not exposed to the user. This would be the special menu the chef cooks for the staff that is unorderable by the general public. That special lobster fried rice with chestnuts and leek. Private API’s are essentially what were used to build the service itself.
It’s mutton time!
One fine Sunday morning, your beloved mother says to you: “Son, could you be a darling and run to the supermarket to get some eggs?”
“Ok Mom!”, you reply and off to the supermarket you go.
Half way there, you spot your Mom and she comes over to you a little awkwardly.
“Son, I’ve changed my mind” she says in a weird sounding voice.
“Forget the eggs, get some baby diapers instead” and as quickly as she appears, she disappears.
So, this all sounds a little weird to you. Why would Mother ask me to get diapers? There isnt’t a baby in the house! In fact, Mom looks kinda weird too. She’s not her usual self.
Something seems a little off but you don’t question wisdom of your mother and happily you get the diapers and return home.
Upon, reaching home, your Mother looks at you and wonders: “Son, where are the eggs? And why on earth did you buy baby diapers?”.
This is exactly what an SQL injection does: it takes the original instructions given by the computer, intercepts it with new instructions. If it’s an malicious SQL injection, the mysterious person masquerading as your Mom might have even told you to buy the eggs and then smash it. But as my friend eloquently put it: SQL injections are by definition not malicious but anecdotally, they almost always are.
In layman terms, a database is a place where information is stored. If you are familiar with Microsoft Excel, a database is conceptually the same thing. In Excel, each worksheet contains a logical set of information presented in columns and rows. So if you have an employee worksheet, the first column could be Name, the second column Age and so forth. The rows will then represent individual employees.
This is exactly what a database does except it stores these information much more efficiently and effective. So, once you have about 100,000 rows in Excel, it starts to get slow. A database allows you to store millions of records without making it slow for you to retrieve data.