API (Aplication Programming Interface)
应用程序接口
直接的说,API就好比是一个信使,发送请求,告诉系统你想要做什么,然后把结果告诉你。
再或者说,不论何时想到API,都应当把它想象成为餐馆的服务生,奔波于数据、应用、和设备之间,去传送数据。
Connectivity is an amazing thing.
By now we are all used to the instant connectivity that puts the
world at our fingertips from desktops or devices .
We can purchase post pin and pick anything anywhere
We are connnected to the world and each other like never before.
But how does it happen ?
How does data get from here to there ?
How do different devices and applications connnect with each other to allow us to place an order , make a reservation or book a flight
with just a few types of quicks
the unsung hero of our connected world is the application programming interface or API
it’s the engine under the hood and is behind the scenes that we take for granted
But it is what makes possible all the interactivity come to expect and rely upon .
But exactly what ia an API.
It is a question everyone asks.
The textbook definition go something like this .
okay to speak plainly an API is the messenger that takes requests and tell a system what you want to do and then returns the response back to you .
直接的说,API就好比是一个信使,发送请求,告诉系统你想要做什么,然后把结果告诉你。
To Give you a familiar example .
Think of an API as a waiter in a restaurant.
Imagine you are sitting at the table with a menu of choices to order from .
In the kitchen is the part as the system which will prepare your order
what is missing is the critical link to commmunicate your order to the kitchen and deliver your food back to your table .
That is where the waiter or API comes in .
The waiter is the messenger and takes your request or order and tells the system in this case the kitchen what to do .
And then delivers the response back to you .in this case food .
举个简单的例子
想象API就是餐馆里的服务生,想象你坐在桌子旁点餐,厨房作为系统的一部分,准备你的订单,缺少一个链接环节将你的订单给厨房,然后将食物端回到餐桌,此处就需要服务生(API),服务生就像一个信使,将你的请求或订单告诉给系统(本例是厨房)要去做什么,然后将结果(本例就是食物)反馈给你。
Now that we have whetted your appetite . 刺激你的食欲
Let us apply this to a real API example ,you are probably familiar with the process of searching for airline flights online.
Just like at a restaurant you have a menu of options to purchase from
a drop-down(下拉) menu in this case . you choose a departure(出发) city and date , a return(目的) city and date ,cabin class(舱位等级) and other varibles .In order to book your flight you interact with the airlines website to access the airline’s database to see if any seats are available on those dates .
And what the cost might be used on certain variables .
But what if you are not using the Airlines website which has direct access to the information .
What if you are using an online travel service
that aggregates(收集) information from many different airlines.
The travel service interacts with the airline’s API.
The API is the interface that like you are helpful where can be asked by that online travel service to get infomation , from the airline system over the internet to book the seats choose meal preferences or baggage options
It also then takes the Airlines response to your request and delivers it right back to the online travel service which then shows it to you .
Now you can see that it is API is that makes it possible for us all to use travel sites.
the same goes for all interactions between applications data and devices .
API 就是一个接口,帮助你从在线旅行服务获得信息,
从线上航空系统预定座位等服务
然后航空公司对你的请求做出回应,然后传递给在线旅行服务,然后展示给你
API就是让我们每个人都可以访问旅行服务页面,
与应用、数据、设备之间的交互也一样,他们都有可以让计算机运行的API。
Whenever you think of an API ,just think of it as your waiter,
running back and forth(奔波于) between applications databases and devices.
to deliver data.and create the connectivity that puts the world at our fingertips.
不论何时想到API,都应当把它想象成为服务生,奔波于数据、应用、和设备之间,去传送数据,创造出让世界触手可及的连接性。