0% found this document useful (0 votes)
349 views3 pages

Overview of API Types and History

An API is a computing interface that defines interactions between software and enables extensions. APIs simplify programming by abstracting implementation details and exposing only relevant objects or actions. There are different types of APIs such as SOAP, REST, and GraphQL that handle requests and data transfer in various ways. Popular API frameworks for developing web applications include Django, Flask, Laravel, and Express which provide tools and functionality through modular design.

Uploaded by

Maqsood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
349 views3 pages

Overview of API Types and History

An API is a computing interface that defines interactions between software and enables extensions. APIs simplify programming by abstracting implementation details and exposing only relevant objects or actions. There are different types of APIs such as SOAP, REST, and GraphQL that handle requests and data transfer in various ways. Popular API frameworks for developing web applications include Django, Flask, Laravel, and Express which provide tools and functionality through modular design.

Uploaded by

Maqsood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

API & its Types

An Application Programming Interface (API) is a computing interface which defines


interactions between multiple software intermediaries. It defines the kinds of calls or requests
that can be made, how to make them, the data formats that should be used, the conventions
to follow, etc. It can also provide extension mechanisms so that users can extend existing
functionality in various ways and to varying degrees.
In building applications, an API simplifies programming by abstracting the
underlying implementation and only exposing objects or actions the developer needs. While
a graphical interface for an email client might provide a user with a button that performs all
the steps for fetching and highlighting new emails, an API for file input/output might give the
developer a function that copies a file from one location to another without requiring that the
developer understand the file system operations occurring behind the scenes.

1. History, Background & Evolution


The idea of the API is much older than the term. British computer
scientists Wilkes and Wheeler worked on modular software libraries in the 1940s for
the EDSAC computer. Joshua Bloch claims that Wilkes and Wheeler "latently invented" the
API, because it is more of a concept that is discovered than invented.
This observation lead to APIs that supported all types of programming, not just
application programming. By 1990, the API was defined simply as "a set of services available
to a programmer for performing certain tasks" by technologist Carl Malamud.
The conception of the API was expanded again with the dawn of web APIs. Roy
Fielding's dissertation Architectural Styles and the Design of Network-based Software
Architectures at UC Irvine in 2000 outlined Representational State Transfer (REST) and
described the idea of a "network-based Application Programming Interface" that Fielding
contrasted with traditional "library-based" APIs. XML and JSON web APIs saw widespread
commercial adoption beginning in 2000 and continuing as of 2020.

 SOAP operates with the two basic functions – GET and POST. GET is used to retrieve
data from the server, while POST is used to add or modify data.
 REST, in its turn, changes the state of the corresponding source by making a request to
the URI (Uniform Resource Identifier).
 GraphQL leverages requests of two types – queries retrieving data from the server, and
mutations changing the data.

 REST vs SOAP
The key difference between SOAP and REST protocols lies in their approach to
handling the app payload. SOAP, with XML used as data format, is far too verbose, both
on the request and the response side. The amount of data transferred within the SOAP
structure was enormous, thus requiring more resources and slowing down the
communication.
With the advance of mobile applications, this approach has quickly become
inefficient, as it affected their performance. REST with its endpoint requests seemed to be
a silver bullet, thus has rapidly turned into the protocol of choice among open API
architecture developers. A REST request, on the contrary, is more efficient, since its
structure is more plain and obvious. It contains all properties of the requested resource,
no matter whether the user needs it or not.
Another disadvantage of SOAP was its support of a single data format, XML, while
REST could process XML, HTML, and JSON.

 REST vs GraphQL
While REST was a kind of a technology breakthrough in the area of API-oriented
architecture, it still left developers wanting more. When Facebook guys started looking for
a different way of fetching data from the server, they were trying to resolve the problem of
under-fetching or over-fetching that the existing API protocols had. In REST or SOAP, a
request for certain data returned all properties associated with it, even those the user did
not need.
GraphQL was designed to take care of this problem. When you make a data query
in GraphQL, you specify exactly what you wish to receive. Such results are achieved
through shifting the data definition functions to the client side, while in REST, data is
defined on the server side. In other words, in REST API architecture, the server defines
which data is to be returned, while in GraphQL API, the server only declares the available
data, and the client specifies what should be returned.

 SOAP vs GraphQL
GraphQL, being the latest innovation in the API architecture evolution, combines
the strong suites of both SOAP and REST. If we compare GraphQL and SOAP, we will
see that both use single endpoint URLs to fetch or modify the data. At the same time,
GraphQL is much more lightweight, thus reducing the network payload. Another similarity
between GraphQL and SOAP is strong data typing. Both protocols declare data types
explicitly, which ensures better communication between applications.
Having mentioned caching as one of the points worth taking into account, we have
to admit that in this respect both SOAP and GraphQL have nothing to boast of. Neither of
them has own caching mechanisms and needs to rely on additional tools.

2. API Frameworks
 Django is a Python-based free and open-source web framework that follows the model-
template-views architectural pattern. Django's primary goal is to ease the creation of
complex, database-driven websites. The framework emphasizes reusability and
"pluggability" of components, less code, low coupling, rapid development, and the
principle of don't repeat yourself. Python is used throughout, even for settings files and
data models. Django also provides an optional administrative create, read, update and
delete interface that is generated dynamically through introspection and configured via
admin models.
 Flask is a micro web framework written in Python. It is classified as a microframework
because it does not require particular tools or libraries. It has no database abstraction
layer, form validation, or any other components where pre-existing third-party libraries
provide common functions. Flask supports extensions that can add application features
as if they were implemented in Flask itself. Extensions exist for object-relational mappers,
form validation, upload handling, various open authentication technologies and several
common framework related tools.
 Laravel is a free, open-source PHP web framework, created by Taylor Otwell and
intended for the development of web applications following the model–view–controller
architectural pattern and based on Symfony. Some of the features of Laravel are a
modular packaging system with a dedicated dependency manager, different ways for
accessing relational databases, utilities that aid in application deployment and
maintenance, and its orientation toward syntactic sugar.
 [Link], or simply Express, is a back end web application framework for [Link],
released as free and open-source software under the MIT License. It is designed for
building web applications and APIs. It has been called the de facto standard server
framework for [Link]. The original author, TJ Holowaychuk, described it as a Sinatra -
inspired server,[5] meaning that it is relatively minimal with many features available as
plugins. Express is the back-end component of the MEAN stack, together with
the MongoDB database software and AngularJS front-end framework.

Common questions

Powered by AI

Express.js, as a minimalistic back-end framework for Node.js, offers a modular architecture with plugins to extend functionality, which suits developers looking for flexibility and lightweight solutions . It is often used in JavaScript-heavy technology stacks like MEAN . Django, in contrast, is a comprehensive Python-based framework following the model-template-view pattern designed for complex, database-driven websites, providing built-in features like ORM and an admin interface . While Express.js serves dynamic and realtime applications efficiently due to its non-blocking I/O, Django excels in applications where rapid development and robust architecture are priorities .

SOAP, with its verbose XML format, results in a large amount of data transfer, which is resource-intensive and slows communication, especially for mobile applications . REST, by contrast, offers a more efficient structure through endpoint requests, supporting XML, HTML, and JSON, which suits mobile applications better due to lower data overhead . GraphQL allows clients to request only the specific data they need, addressing REST's issue of over-fetching or under-fetching, which optimizes payload size and enhances efficiency for mobile networks . This focused data retrieval in GraphQL helps improve performance in environments where data bandwidth is limited, such as mobile applications .

A developer might opt for Flask over Django due to Flask's minimalistic design and flexibility, making it suitable for small to medium-sized projects that do not require the overhead of a larger framework . Flask allows developers freedom in choosing third-party tools, whereas Django includes built-in components like an ORM and admin interface, which can increase complexity for certain applications . The trade-off is that Flask may lack the extensive built-in functionality of Django, requiring additional setup and integration for features like form validation or database management .

Express.js reflects characteristics of the Sinatra framework through its minimalistic and flexible design, emphasizing simplicity and speed over completeness . Much like Sinatra, Express.js provides basic web application features and allows developers to expand functionality through middleware and plugins . This similarity makes it appealing to developers who appreciate scalability without the overhead of more comprehensive frameworks, leading to its widespread adoption among Node.js developers . Its simplicity and modular design make it a popular choice for building APIs and services, contributing to its reputation as a standard for server frameworks in JavaScript environments .

APIs evolved from modular software libraries in the 1940s by Wilkes and Wheeler, who laid the groundwork for the concept . Initially defined in 1990 by Carl Malamud as 'a set of services available to a programmer,' APIs expanded significantly with the introduction of web APIs . Roy Fielding's work in 2000 with REST helped differentiate network-based APIs from library-based ones, adding HTTP-based communication and the standardization of XML and JSON as data formats . This evolution reflects a shift from closed to open systems, aiming for interoperability and efficiency in web-based environments .

The model-template-views (MTV) pattern in Django separates concerns by dividing the application logic (models), data presentation (templates), and user-facing interaction (views). This separation facilitates rapid development by allowing parallel development of different components by separate teams, which can increase project speed significantly . Scalability is enhanced as developers can optimize or replace specific components independently, ensuring that changes in one part do not necessitate rewriting others . Compared to different architectural patterns, the MTV pattern offers a structured framework that integrates well with Django's tools and promotes a clean, organized codebase, crucial for maintaining large applications .

Django's DRY principle promotes reducing repetition of software patterns, which simplifies maintenance and minimizes the chance of errors by centralizing code changes . This is particularly beneficial in large web applications where repetitive code can lead to unwieldy maintenance and increased technical debt . However, the challenge lies in achieving the right level of abstraction; over-abstraction can lead to complexity and reduce code readability, making it harder for new developers to understand the system . Additionally, excessive adherence to DRY might limit developers' flexibility to implement specific solutions for unique business requirements .

Laravel enhances PHP's capabilities by providing a model-view-controller architecture conducive to clean and maintainable code . Its features include a modular packaging system with a dedicated dependency manager, easing complex application scalability . Laravel's approach to database access and deployment utilities assists developers in managing relational databases and streamlining the deployment process . Its syntactic sugar offers simplicity in coding tasks that can be verbose in pure PHP, giving developers a powerful toolset for rapid and efficient application development .

GraphQL addresses the data fetching issues of REST and SOAP by allowing requests to specify exactly what data is needed, avoiding over-fetching and under-fetching . Unlike REST, where the server defines the data to be returned, GraphQL shifts data definition to the client side, granting developers more flexibility . Additionally, GraphQL uses a single endpoint for both fetching and modifying data, and employs strong data typing similar to SOAP, leading to improved communication between applications .

Strong data typing in GraphQL and SOAP requires explicit declaration of data types, enhancing application stability by making communication between applications less error-prone and more predictable . It ensures that API consumers and providers have a clear contract about the structure of the data being exchanged, reducing runtime errors caused by unexpected data types . This typing discipline aids developers in anticipating and handling errors early in the development process, contributing to more robust and reliable applications . However, it can also increase initial setup complexity as all data structures must be carefully defined, which can be cumbersome in rapidly evolving applications .

You might also like