DEV Community

Humza Hasan
Humza Hasan

Posted on

API 101

API or Application Programming Interface is a software intermediary that allows two applications to talk to each other. In simple words API is a software which helps you get your end result according to your need without worrying what process happens in the backend.

Catering

For example, the waiter of a restaurant you visit caters to your need by providing you the menu card, taking your order, serving your food and finally giving you the bill. You don't have to worry about how the food is getting prepared, you don't have to go to the kitchen to collect it nor you have to do the calculation of the bill. The waiter here serves the purpose of API between you and the restaurant, who does all the work without exposing you the detailed process which happens in the behind the kitchen doors.

Types of API

  • Based on Ownership - Public API, Partner API, Internal API, Composite API
  • Based on Protocols - Rest, SOAP, RPC
  • Based on Categorized - Data API, Internal Service API, External Service API, User Experience API
  • Based on Communication Level - High level abrstraction, Low level abstraction

Too Much

In this article we will be looking into the first two types, i.e, Based on Ownership and Based on Protocols.

Based on Ownership

  • Public API - Also known as Open API, are those APIs which are publically available for use without any restriction to access.

  • Private API - In this type of API a developer needs specific rights or licenses in order to access as they are not available to the public.

  • Internal API - These types of API are used internally inside an organization. It can be used to different teams internally to improve its product and services.

  • Composite API - In this type of API design we approach to batch API requests sequentially into a single API call. Rather than multiple round trips to a server, a client can make one API request with a chain of calls and receive one response.

Based on Protocols

  • SOAP - SOAP – Simple Object Access Protocol – is probably the better known of the two models.SOAP relies heavily on XML, and together with schemas, defines a very strongly typed messaging framework.Every operation the service provides is explicitly defined, along with the XML structure of the request and response for that operation.

  • REST - REST
    REST – stands for Representational State Transfer. It is a software architecture style that relies on a stateless communications protocol, most commonly, HTTP. REST structures data in XML, YAML, or any other format that is machine-readable, but usually JSON is most widely used. REST follows the object-oriented programming paradigm of noun-verb. REST is very data-driven, compared to SOAP, which is strongly function-driven. You may see people refer to them as RESTful APIs or RESTful web services. They mean the same thing and can be interchangeable.

Resources

Discussion (0)