APIs have been revolutionizing the world since the birth of first-generation computers but they were not coded in high-level languages as they are being done today. The APIs are core concepts of programming which every programmer has to learn for achieving working levels of proficiency. As of now, APIs have reached a high level of sophistication which needs to be classified into types of APIs to get a good level of understanding.
APIs are an acronym for Application Programming Interface which means a set of functions and procedures allowing the creation of applications that access the features or data of other application, service or an operating system.
In layman terms, APIs are pipelines which connect applications these connections are done using the features of another application into the main application, In APIs types of messages, are defined which will be communicated through these APIs.
Read: "What is an API and How it works?"
For example, many websites show the live feed from twitter so they use APIs from twitter on their website to fetch and display the live feed.
The classification of APIs can be done on three parameters which are listed as follows:
On Ownership level there are four main types of APIs:
High-level APIs are those that we use generally in REST form where programmers have a high level of abstraction and they are only concerned about performing a limited functionality.
Low-level APIs have a lower level of abstraction hence they are most detailed, which allows the programmer to manipulate functions within an application module or within hardware at a granular level. Usually, Low-level APIs are used in sending the real-time video or media feed in response to a trigger like Vulkan APIs.
In web service APIs the classification is done on the type of communication and behavioural approach used in building APIs:
Web service APIs are small applications that use URLs or web addresses on the internet to provide their services to desktop, mobile, web applications and others.
SOAP (Simple Object Access Protocol) APIs are more complex than its peers. These APIs have their own communication protocol called Simple Object Access Protocol which makes them a bit more defining than REST in terms of the level of security and the approach to how messages are sent. SOAP offers comprehensive security, built-in ACID (Atomicity, Consistency, Isolation, Durability) compliance and retry logic for reliable messaging functionality which makes it a more suitable for enterprise application which deals with banking transactions, LDAP interaction and more.
Read: "Monolithic vs Microservice Architecture- Pros and Cons"
SOAP is a standardized protocol which uses only proprietary XML format for transferring structured information that’s more function-driven. The APIs are used to send payloads which is data, its type and communication preferences. Since SOAP uses XML to send payloads hence it requires more bandwidth. In addition to SSL support SOAP uses WS-Security, which is great at the transport level and a bit more comprehensive than SSL. Due high level of security SOAP-based calls cannot be cached. SOAP is closely coupled with the server, having a strict communication contract with it which makes it more difficult to make changes or updates. Interacting with a SOAP API needs knowledge about everything even before you can even initiate an interaction.
Read: "Top Web Development Technologies and Frameworks"
SOAP has built-in ACID compliance which reduces anomalies and protects the integrity of a database by prescribing exactly how transactions can interact with the database. ACID is much better than data consistency models. ACID is used in structural databases like Oracle’s SQL database to deal with banking transactions and inventory management in behemothic eCommerce platforms.
SOAP has successful/retry logic built-in and provides end-to-end reliability through SOAP intermediaries.
The use case where you want to use SOAP API in building an application is only the desire to achieve a high level of security.
XML-RPC (Extensible markup language – Remote Procedure Calls) is a protocol that uses a specific XML format to transfer data. XML-RPC uses minimum bandwidth and is much simpler and older than SOAP.
JSON-RPC (JavaScript Object Notation) is a protocol which uses JSON format to transfer data. The RPC calls are one of the methods that are used by services to communicate in a microservice architecture.
REST (Representational State Transfer) is a more data-driven architectural style that we use in building REST APIs. REST APIs are based on URIs (Uniform Resource Identifier) HTTP protocol, and the use of JSON for a data format, which is super browser-compatible. REST APIs can be simple to build and scale as compared to other types of APIs.
The reasons why you may want to build an API to be RESTful because it includes resource limitations, fewer security requirements, browser client compatibility, discoverability, data health, and scalability.
Read: "What is Serverless Web Application Development?"
Here’s some bonus info for reading the whole article
In REST (Representational “State” Transfer) architecture it is defined that the server does not store any state about the client session on the server-side. This restriction is called Statelessness. Each request from the client to server must contain all of the information necessary to understand the request and it cannot take advantage of any stored context on the server. The Session state is therefore kept entirely on the client. The client is responsible for storing and handling all application state-related information on client-side. It also means that the client is responsible for sending any state information to the server whenever it is needed. So, there should not be any session affinity or sticky sessions on the server.
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。