How to learn the concepts of API ? - Must know

What is API?

API is referred to Application Programming Interface. It is a set of methods of communication between various software components.
Example :  API for an object-oriented language such as Java provides a specification of classes and their methods.
An API in web development, is a set of Hypertext Transfer Protocol (HTTP) request messages, along with a definition of the structure of response messages, which is usually in an Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format.

What is API used for ?

An API (Application Programming Interface) is the means by which third parties can write code that interfaces with other code and Web Service is a type of API, one that operates over HTTP.
An API facilitates communication between two different software systems.  More specifically APIs is often used to communicate between libraries , operating systems  and software applications, and  An API is much like a a software library.APIs classification on the bases of the way we use them.Some of the popular API Examples :
  • YouTube API
  • Twitter API
  • Google Map API
  • Flicker API

Types of API 

Libraries and frameworks


  • An API is related to a software libraryAn API for a procedural language is a set of basic routines to execute code, manipulate data or handle errors, while an API for an object-oriented language such as Java would provide a specification of classes and their class methods.

  • Language bindings are also APIs. These APIs map the features and capabilities of one language to an interface implemented in another language.
  • An API can also be a software framework.

Web APIs

Web APIs are those interfaces through which allow interactions between an enterprise and applications that use its assets. Web API is defined as a set of Hypertext Transfer Protocol (HTTP) request messages, along with a definition of the structure of response messages, which is usually in an Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format. 
Making use of web APIs, web communities have been able to share content and data between several communities and different applications. Thus content created at one place can be dynamically posted multiple locations on the web.

Remote APIs

Remote APIs are often used by developers to manipulate remote resources through protocols. For example, Java remote method invocation API uses the Java Remote Method Protocol to allow invocation of functions that operate remotely, but appear local to the developer. Remote APIs maintain the object abstraction in object-oriented programming; a method call, executed locally on a proxy object, invokes the corresponding method on the remote object, using the remoting protocol, and acquires the result to be used locally as return value. 

Operating systems API

An API can specify the interface between an application and the operating system.An API is different from an application binary interface (ABI), an API is source code based while an ABI is binary based.


SOAP

SOAP (Simple Object Access Protocol) is a protocol specification. SOAP is used for exchanging structured information in the implementation of web services in computer networks. SOAP  uses XML for its message format, and it mostly dependent on application layer protocols, like Hypertext Transfer Protocol (HTTP) or Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.
SOAP enables processes running on different operating systems (such as Windows and Linux) to communicate using Extensible Markup Language (XML). Since Web protocols like HTTP are installed on all operating systems therefore SOAP allows clients to invoke web services and receive responses independent of language and platforms.

SOAP has following major characteristics:

  • Extensibility (security and WS-Addressing are among the extensions under development)
  • Neutrality (SOAP can operate over any protocol such as HTTP, SMTP, TCP, UDP, or JMS)
  • Independence (SOAP allows for any programming model)

REST

Representational state transfer (REST) or RESTful Web services provide interoperability between computer systems on the Internet. RESTful Web services allow requesting systems to access and manipulate textual representations of Web resources using a uniform and predefined set of stateless operations. Other forms of Web service exist, which expose their own arbitrary sets of operations such as WSDL and SOAP.
 In a RESTful Web service, requests made to a resource's URI will fetch a response that can be in XMLHTMLJSON.  Using HTTP, as is most common, the kind of operations available include those predefined by the HTTP verbs GET, POST, PUT, DELETE and so on. REST systems has a fast performance, reliability, and the ability to grow, by re-using components that can be managed and updated without affecting the system as a whole.

RESTful Web services have following major characterstics :

  • Base URL, such as https://richasd.blogspot.in/p/java_29.html
  • An internet media type that defines state transition data elements (e.g., Atom, microformats, application/vnd.collection+json,[14]:91–99 etc.) The current representation tells the client how to compose requests for transitions to all the next available application states. This could be as a URL.
  • Standard HTTP methods (e.g., OPTIONS, GET, PUT, POST, and DELETE)