Browse Courses

Web Api

This document explains the fundamentals of web applications and APIs, their differences, architectures, and how they enable communication between software components. It covers web app structure, API roles, and practical examples for modern development.

This document explores the structure and function of web applications and APIs, clarifying their differences, architectures, and how they enable seamless communication between software systems. Readers will learn about web app components, API roles, and real-world examples of their integration.


Introduction to Web Applications and APIs

A web application (web app) is a program stored on a remote server and delivered over the internet. Users interact with web apps through browsers, accessing services like e-commerce, webmail, and more. Most web apps are compatible with all modern browsers, regardless of platform.


Structure of a Web Application

A web app processes client requests using three main components:

ComponentRole
Web ServerManages incoming client requests
App ServerExecutes the requested tasks
DatabaseStores and retrieves necessary information

Front-end code is typically written in JavaScript, HTML, or CSS, while back-end code uses languages like Python, Java, or Ruby.


Advantages of Web Applications

Web apps offer several benefits over locally installed software:

  • The same app version is available to multiple users simultaneously.
  • Users can access the app from any device—desktop, laptop, or mobile—using their preferred browser.
  • No installation is required on local systems.

Understanding APIs

An Application Programming Interface (API) is a software component that enables two otherwise unconnected apps to communicate. APIs provide standardized rules and functions for requesting or modifying data within an app.

APIs increase flexibility for developers and allow data exchange between closed-off systems. For example, mobile apps often request permission to access device features like location or camera through APIs.


Real-World Example: Weather App and API

A weather app does not generate weather data itself. Instead, it requests information from a weather API, which connects the app to external data sources. The API enables the app to display up-to-date forecasts on the user’s device.


API Architectures

Several architectures exist for building APIs, with the most popular being:

  • REST (Representational State Transfer)
  • SOAP (Simple Object Access Protocol)

These architectures define how APIs structure requests and responses. REST and SOAP will be discussed in detail in later modules.


Benefits and Features of APIs

APIs offer multiple advantages:

  • Improve connectivity between applications
  • Support CRUD (Create, Read, Update, Delete) operations
  • Work with HTTP verbs such as PUT, POST, DELETE, and GET
  • Are customizable due to their HTTP-based nature

API is a broad term for any software that links two parts of a system. Web apps are a type of API that connects the front end and back end.


Web Apps vs. APIs: Key Differences

To clarify the distinction, consider an e-commerce shopping service:

  • Accessing the service via a browser: The browser acts as the API connecting the user to the web app.
  • Accessing via a mobile app: The app acts as the API connecting to the same web service.

All web apps share data with other apps, making them a form of API. However, not all APIs are web apps. APIs can be online (web-based) or offline.

AspectWeb AppAPI
PurposeUser-facing applicationInterface for app-to-app communication
AccessThrough browser or deviceProgrammatically, via code
ExampleE-commerce site, webmailWeather API, payment gateway
Network NeedAlways requires a networkMay or may not require a network

Summary Table: Web Apps and APIs

FeatureWeb AppAPI
User InterfaceYesNo
Direct User InteractionYesNo
Data SharingYesYes
Requires NetworkYesSometimes

Conclusion

Web applications and APIs are foundational to modern software development. Web apps provide user-facing services accessible from any device, while APIs enable communication between software components. Understanding their differences and integration is essential for building scalable, flexible systems.


FAQ

  1. A program installed on a local device and accessed offline
  2. A program stored on a remote server and accessed through a browser
  3. A hardware device for internet connectivity
  4. A type of database management system
(2) A web application is stored on a remote server and accessed by users through a browser, enabling cross-platform access without local installation.

  1. To provide a user interface for end-users
  2. To enable communication between otherwise unconnected applications
  3. To store and retrieve data from databases
  4. To manage hardware resources
(2) APIs enable communication and data exchange between different software components or applications.

  1. Users can access the app from any device with a browser
  2. The same version is available to all users simultaneously
  3. Users must install the app on every device
  4. No installation is required on local systems
(3) Web applications do not require installation on each device, making them more accessible than traditional software.

  1. It generates weather data internally
  2. It requests data from a weather API
  3. It uses the device’s sensors to predict weather
  4. It does not provide real weather data
(2) The app requests data from a weather API, which connects it to external weather data sources.

  1. APIs always require a user interface
  2. APIs can support CRUD operations
  3. APIs can be based on HTTP
  4. APIs enable app-to-app communication
(1) APIs do not require a user interface; they are designed for programmatic communication between software components.

ComponentRole
A. Web Server1. Executes the requested tasks
B. App Server2. Stores and retrieves necessary information
C. Database3. Manages incoming client requests
A-3, B-1, C-2.

  1. All APIs are web apps
  2. All web apps are APIs, but not all APIs are web apps
  3. APIs cannot function without a user interface
  4. Web apps do not require a network connection
(2) All web apps are a form of API, but APIs can exist in both online and offline forms.

Web applications always require a network connection, while APIs may or may not require one.

True. Web apps are accessed over the internet, but APIs can be used for both networked and offline communication between software components.