An API can be created for applications, libraries, operating systems, etc., as a way of defining their "vocabularies" and resources request conventions (e.g. function-calling conventions). It may include specifications for routines, data structures, object classes, and protocols used to communicate between the consumer program and the implementer program of the API.
The term API may be used to refer to a complete interface, a single function, or even a set of APIs provided by an organization. Thus, the scope of meaning is usually determined by the context of usage.
In procedural languages like C language the ''action'' is usually ''mediated'' by a function call. Hence the API includes usually a description of all the functions/routines it provides.
For instance: the math.h
include file for the C language contains the definition of the function prototypes of the mathematical functions available in the C language library for mathematical processing (usually called libm
).
This file describes how to ''use'' the functions included in the given library: the function prototype is a signature that describes the number and types of the parameters to be passed to the functions and the type of the return value.
The ''behavior'' of the functions is usually described in more details in a human readable format in printed books or in electronic formats like the man pages: e.g. on Unix systems the command
man 3 sqrt
will present the signature of the function sqrt
in the form:
That means that the function returns the square root of a positive floating point number (single
or double
precision) as another floating point number.
Hence the API in this case can be interpreted as the collection of the included files used by the C language and its human readable description provided by the man pages.
python comes with the tool pydoc:
ruby comes with the tool ri
:
Java comes with the documentation organized in html pages (JavaDoc format), while Microsoft distributes the API documentation for its languages (Visual C++, C#, Visual Basic, F#, etc...) embedded in Visual Studio's help system.
The API in this case can be conceived as the totality of all the methods publicly exposed by the classes (usually called the class ''interface''). This means that the API prescribes the methods by which one interacts with/handles the objects derived from the class definitions.
More generally, one can see the API as the collection of all the ''kinds'' of objects one can derive from the class definitions, and their associated possible behaviors. Again: the use is mediated by the public methods, but in this interpretation, the methods are seen as a ''technical detail'' of how the behavior is implemented.
For instance: a class representing a Stack
can simply expose publicly two methods push()
(to add a new item to the stack), and pop()
(to extract the last item, ideally placed on top of the stack).
In this case the API can be interpreted as the two methods pop()
and push()
, or, more generally, as the ''idea'' that one can use an item of type Stack
that implements the behavior of a stack: a pile ''exposing'' its top to add/remove elements.
This concept can be carried to the point where a class interface in an API has no methods at all, but only behaviors associated with it. For instance, the Java language and Lisp API include the interface Serializable
, which requires that each class that implements it should behave in a serialized fashion. This does not require to have any public method, but rather requires that any class that implements it to have a representation that can be ''saved'' (serialized) at any time (this is typically true for any class containing simple data and no link to external resources, like an open connection to a file, a remote system, or an external device).
Similarly the behavior of an object in a concurrent (multi-threaded) environment is not necessarely determined by specific methods, belonging to the interface implemented, but still belongs to the API for that Class of objects, and should be described in the documentation.
In this sense, in object-oriented languages, the API defines a set of object behaviors, possibly mediated by a set of class methods.
In such languages, the API is still distributed as a library. For example, the Java language libraries include a set of APIs that are provided in the form of the JDK used by the developers to build new Java programs. The JDK includes the documentation of the API in JavaDoc notation.
The quality of the documentation associated with an API is often a factor determining its success in terms of ease of use.
An API can also be related to a software framework: a framework can be based on several libraries implementing several APIs, but unlike the normal use of an API, the ''access'' to the behavior ''built into the framework'' is mediated by extending its content with new classes plugged into the framwork itself. Moreover the overall program flow of control can be out of the control of the caller, and in the hands of the framework via inversion of control or a similar mechanisms.
In general the difference between an API and a protocol is that the protocol defines a standard way to exchange requests and responses based on a common transport and agreeing on a data/message exchange format, while an API is usually implemented as a library to be used directly: hence there can be no ''transport'' involved (no information physically transferred from/to some remote machine), but rather only simple information exchange via ''function calls'' (local to the machine where the elaboration takes place) and data is exchanged in formats expressed in a specific language.
When an API implements a protocol it can be based on proxy methods for remote invocations that underneath rely on the communication protocol. The role of the API can be exactly to hide the detail of the transport protocol. E.g.: RMI is an API that implments the JRMP protocol or the IIOP as RMI-IIOP.
Protocols are usually shared between different technologies (system based on given computer programming languages in a given operating system) and usually allow the different technologies to exchange information, acting as an abstraction/mediation level between the two ''worlds''. While APIs are specific to a given technology: hence the APIs of a given language cannot be used in other languages, unless the function calls are wrapped with specific adaptation libraries.
When a message is exchanged via a protocol between two different platforms using objects on both sides, the object in a programming language can be transformed (marshalled and unmarshalled) in an object in a remote and different language: so, e.g., a program written in Java invokes a service via SOAP or IIOP written in C# both programs use APIs for remote invocation (each locally to the machine where they are working) to (remotely) exchange information that they both convert from/to an object in local memory.
Instead when a similar object is exchanged via an API local to a single machine the object is effectively exchanged (or a reference to it) in memory.
In this case the virtual machine enables the language interoperation thanks to the common denominator of the virtual machine that abstracts from the specific language using an intermediate bytecode.
Hence this approach maximizes the code reuse potential for all the existing libraries and related APIs.
Microsoft has shown a strong commitment to a backward compatible API, particularly within their Windows API (Win32) library, such that older applications may run on newer versions of Windows using an executable-specific setting called "Compatibility Mode".
Apple Inc. has shown less concern, breaking compatibility or implementing an API in a slower "emulation mode"; this allows greater freedom in development, at the cost of making older software obsolete.
Among Unix-like operating systems, there are many related but incompatible operating systems running on a common hardware platform (particularly Intel 80386-compatible systems). There have been several attempts to standardize the API such that software vendors may distribute one binary application for all these systems; however, to date, none of these have met with much success. The Linux Standard Base is attempting to do this for the Linux platform, while many of the BSD Unixes, such as FreeBSD, NetBSD, and OpenBSD, implement various levels of API compatibility for both backward compatibility (allowing programs written for older versions to run on newer distributions of the system) and cross-platform compatibility (allowing execution of foreign code without recompiling).
#Protecting information on APIs from the general public. For example, Sony used to make its official PlayStation 2 API available only to licensed PlayStation developers. This enabled Sony to control who wrote PlayStation 2 games. This gives companies quality control privileges and can provide them with potential licensing revenue streams. #Making APIs freely available. For example, Microsoft makes the Microsoft Windows API public, and Apple releases its APIs Carbon and Cocoa, so that software can be written for their platforms.
A mix of the two behaviors can be used as well.
Below are listed some interface generator tools which bind languages to APIs at compile time.
Category:Technical communication *
ar:واجهة برمجة التطبيقات bn:অ্যাপলিকেশন প্রোগ্রামিং ইন্টারফেস bs:Application Programming Interface bg:Приложно-програмен интерфейс ca:API cs:API da:Application programming interface de:Programmierschnittstelle et:Rakendusliides el:Διεπαφή προγραμματισμού εφαρμογών es:Interfaz de programación de aplicaciones eu:Application Programming Interface fa:رابط برنامهنویسی نرمافزار fr:Interface de programmation gl:API ko:API hr:API id:Antarmuka pemrograman aplikasi it:Application programming interface he:ממשק תכנות יישומים ka:აპლიკაციის პროგრამირების ინტერფეისი lt:Aplikacijų programavimo sąsaja hu:Alkalmazásprogramozási felület ml:ആപ്ലിക്കേഷൻ പ്രോഗ്രാമിങ് ഇന്റർഫേസ് nl:Application programming interface ja:アプリケーションプログラミングインタフェース no:API (programmering) pms:API pl:Application Programming Interface pt:API ro:API ru:Интерфейс программирования приложений sq:Interfejsi për programimin e aplikacioneve simple:Application programming interface sk:Application programming interface sr:Апликациони програмски интерфејс sh:API fi:Ohjelmointirajapinta sv:Application Programming Interface ta:பயன்பாட்டு நிரலாக்க இடைமுகம் th:เอพีไอ tr:Uygulama programlama arayüzü uk:Прикладний програмний інтерфейс vi:Giao diện lập trình ứng dụng zh:应用程序接口This text is licensed under the Creative Commons CC-BY-SA License. This text was originally published on Wikipedia and was developed by the Wikipedia community.
The World News (WN) Network, has created this privacy statement in order to demonstrate our firm commitment to user privacy. The following discloses our information gathering and dissemination practices for wn.com, as well as e-mail newsletters.
We do not collect personally identifiable information about you, except when you provide it to us. For example, if you submit an inquiry to us or sign up for our newsletter, you may be asked to provide certain information such as your contact details (name, e-mail address, mailing address, etc.).
When you submit your personally identifiable information through wn.com, you are giving your consent to the collection, use and disclosure of your personal information as set forth in this Privacy Policy. If you would prefer that we not collect any personally identifiable information from you, please do not provide us with any such information. We will not sell or rent your personally identifiable information to third parties without your consent, except as otherwise disclosed in this Privacy Policy.
Except as otherwise disclosed in this Privacy Policy, we will use the information you provide us only for the purpose of responding to your inquiry or in connection with the service for which you provided such information. We may forward your contact information and inquiry to our affiliates and other divisions of our company that we feel can best address your inquiry or provide you with the requested service. We may also use the information you provide in aggregate form for internal business purposes, such as generating statistics and developing marketing plans. We may share or transfer such non-personally identifiable information with or to our affiliates, licensees, agents and partners.
We may retain other companies and individuals to perform functions on our behalf. Such third parties may be provided with access to personally identifiable information needed to perform their functions, but may not use such information for any other purpose.
In addition, we may disclose any information, including personally identifiable information, we deem necessary, in our sole discretion, to comply with any applicable law, regulation, legal proceeding or governmental request.
We do not want you to receive unwanted e-mail from us. We try to make it easy to opt-out of any service you have asked to receive. If you sign-up to our e-mail newsletters we do not sell, exchange or give your e-mail address to a third party.
E-mail addresses are collected via the wn.com web site. Users have to physically opt-in to receive the wn.com newsletter and a verification e-mail is sent. wn.com is clearly and conspicuously named at the point of
collection.If you no longer wish to receive our newsletter and promotional communications, you may opt-out of receiving them by following the instructions included in each newsletter or communication or by e-mailing us at michaelw(at)wn.com
The security of your personal information is important to us. We follow generally accepted industry standards to protect the personal information submitted to us, both during registration and once we receive it. No method of transmission over the Internet, or method of electronic storage, is 100 percent secure, however. Therefore, though we strive to use commercially acceptable means to protect your personal information, we cannot guarantee its absolute security.
If we decide to change our e-mail practices, we will post those changes to this privacy statement, the homepage, and other places we think appropriate so that you are aware of what information we collect, how we use it, and under what circumstances, if any, we disclose it.
If we make material changes to our e-mail practices, we will notify you here, by e-mail, and by means of a notice on our home page.
The advertising banners and other forms of advertising appearing on this Web site are sometimes delivered to you, on our behalf, by a third party. In the course of serving advertisements to this site, the third party may place or recognize a unique cookie on your browser. For more information on cookies, you can visit www.cookiecentral.com.
As we continue to develop our business, we might sell certain aspects of our entities or assets. In such transactions, user information, including personally identifiable information, generally is one of the transferred business assets, and by submitting your personal information on Wn.com you agree that your data may be transferred to such parties in these circumstances.