Thread: API Simplified?
View Single Post
Old 06-01-2016, 07:31 PM  
brandonstills
Confirmed User
 
brandonstills's Avatar
 
Join Date: Dec 2007
Location: Chatsworth, CA
Posts: 1,964
Mirroring is making a copy of a site. But nowadays a site typically has what is called a backend in addition to the public facing side that exposes HTML, Javascript, CSS, images, and movies that the user can download through their browser. Nobody can see the backend except the people working on it (programmers and business employees who have access to it). The backend dynamically spits out HTML to the browser and that is what can be mirrored. There's no way to copy a dynamic site entirely because it is not exposed. You can think of it like this. You can photocopy a painting but that doesn't mean you now have the ability to create other works of art in the style of that artist. It's not something that can be copied (only imitated). You can copy the painting because it has been exposed to the world, but you can't copy his brain so that you can create other variations. The public facing site that people see in their browser is the output, but there's a whole bunch of stuff going on behind the scene that generates that output that nobody can see.

Now sometimes, businesses want other people to be able to call upon the dynamic parts for their own purposes. Ex: a travel site that contacts a bunch of airlines and hotels to get data about deals on certain days at certain places with specific criteria. To do this a business will expose an API.

An API is allows one site (or mobile app, or whatever) to talk to another. For flights you might have something that looks like.

http://www.awesomeflights.com/api/findFlights?departing=LAX&arriving=SFO&startDate=2 016-06-15

In which case the server might respond with something like:

flights: [
{depart: 'LAX', arrive: 'SFO', flightNumber: '1234', departTime: '8:57 AM', airline: 'Southwest', price: 123.45},
... more flight options
]

And then awesomeflights could take that to spit out a list that the user sees in their browser.

Businesses generally expose APIs to other companies so that they can get more business. In the example of airlines, it's a pain in the ass for someone to go to each different airline individually and see what flights are available. They want to go to just one place. So someone who comes along and says, hey, I have an idea of how I can improve upon your business, can simply access their API and create their own site that has the same functionality.

APIs effectively exposes a part of the backend that the business wants to make available to others.

Another example would be a County Clerk Office that gives you access to information. You go there and say I want information on XYZ, or I want to make a payment for XYZ, or whatever. Those are all services and transactions that a person could perform. The API would be the automated means of doing that so a computer could do it. And then other people can build their own value added services and businesses that build on top of those data / functionality.
brandonstills is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook