An API architecture is?a framework of rules for creating software interfaces. Basically it refers to the process of developing a software interface that unveils backend data and application functionality to be availed by other applications or resources.
A specific API can be coined as efficient and effective when it is easy to read and work with, i.e., the resources and associated operations can be retained by developers who constantly work with it.
There are 4 layers of API Architecture:
- Information Management Layer which includes up to the minute database management systems and its management. This needs to be exclusively authentic and high performing.
- Application Layer which is where the basic application runs on. This can be built on any technology or framework and can be upgradable and replaced. Present Day Application Layers are built on microservices.
- Integration Layer comprises of formerly used Enterprise Service Buses which is availed for connecting your digital services. Currently used, an?API gateway is?a component of the app-delivery infrastructure that sits between clients and services and provides centralized handling of API communication between them.
- Interaction Layer which is where the applications and services communicate with the data sitting in the information layer.
Now lets take a deep dive into types of API Architecture:
APIs are on a whole acquired and exercised in web applications. There are four different types of API's generally used in web services: public, partner, private and composite.
- Public API's ?which is open and available for use by any outside developer or business. These are also referred to?open APIs?or?external APIs.
- Partner API's which is only available to definite and authorized outside developers or API consumers, is a means to facilitate business-to-business(B2B) architecture. This includes very strong authorization, authentication and security as partners have license's to such API's.
- Private API's which is only used within the same organization.
- Composite API's which combine two or more APIs to facilitate an order of interconnected operations.
- REST API : A REST API is an API that conforms to the design principles of the REST, or?representational state transfer?architectural style. The request made by the client is delivered in several formats via HTTP : JSON(most commonly used), HTML, XLT, Python, Php or Text.
- SOAP : Simple Object Access Protocol is a message specification for exchanging information between systems and applications. When it comes to API's , a SOAP API is developed in a more structured and formalized way. SOAP messages are XML Documents.
- GraphQL: GraphQL is a query language and server-side runtime for?API's?that preferences giving clients exactly the data they request and no more.?This makes the protocol fast, flexible and developer-friendly.
- gRPC (Google Remote Procedure Call): gRPC is when a client request can directly call a method on a server application on a different machine as if it were a local object, making it flexible to create distributed applications and services. It runs on HTTP/2 and uses binary data. It uses Protocol Buffers for serializing payload data.
- WebSockets: The WebSocket API?invokes your backend based on the content of the messages it receives from client. Netflix uses WebSockets for real time streaming updates and for its video player controls.
- Webhooks: A webhook is?an HTTP-based callback function that allows lightweight, event-driven communication between 2 application programming interfaces (APIs).
- MQTT (Message Queuing Telemetry Transport): MQTT is a publish/subscribe communication protocol that uses TCP/IP sockets or WebSockets. MQTT over WebSockets can be secured with SSL. The main task of MQTT API is to send a complete set of commands, such as create clients, list clients, delete clients, etc., from MMC to the MQTT broker.