API is an acronym for Application Programming Interface. API is a set of rules and mechanisms that enable and specifies the interaction between various software programs or applications. It is a combination of protocols, commands, and objects using which developers can connect different programs with an access to specific features. API ensures software-to-software interaction. But it is not a user interface.
Every API has a documentation written for developers. The documentation specifies the API syntax, specifics of its operating, ways to solve potential issues. It brings standardization and simplification to interaction between applications.
Example of API
An application is downloaded and installed on a mobile device. A user makes a request and the application sends the request to a server via Internet. The server receives and interprets the data, performs required actions and sends the results back to the mobile device. The application gets the data, interprets it and presents to the user in a readable form. All these actions happen due to API.
A button for sharing data on social networks, e.g., Facebook, Twitter, embedded on a website can perform the function via API.
Web service APIs
A web service is a system that enables the interaction and data exchange between programs, objects, and databases. It provides the information in a special format that is understandable for other applications via URL (Uniform Resource Locator), e.g., an Internet address. The interaction between a client and a web service is possible due to HTTP (Hypertext Transfer Protocol) requests and responses that have a standard structure. They consist of a head with metadata and a message of XML (Extensible Markup Language) and JSON (JavaScript Object Notation) formats.
A number of protocols, e.g., sets of rules for data transferring, can be used for developing web APIs. In order to realize different systems, the following protocols can be used:
SOAP (Simple Object Access Protocol) is a protocol for exchanging data between various platforms in XML format over application layer protocols like HTTP, FTP (File Transfer Protocol), etc. It uses a strict data typing that ensures the protection of data during its sharing between a client and a server. SOAP uses an interface that can include almost unlimited number of methods.
REST (Representational State Transfer) is an architectural style that enables the interoperability of software and computer systems on the Internet. It does not depend on specifics protocols. It provides a flexible integration by using a standardized set of processes. REST models have no requirements for data typing. This reduces the size of packages. REST bases the concept of resources, and it has a limited number of methods.
XML-RPC (Extensible Markup Language Remote Procedure Call) is a remote procedure call that uses XML to encode the data and HTTP to transfer information between a client and a server. It provides a standardized set of commands and data types which developers use to get access to the functionality of another program.
JSON-RPC (JavaScript Object Notation Remote Procedure Call) is a remote procedure call similar to XML-RPC, but it uses JSON for data encoding.