Skip to content

What is api?

API stands for Application Programming Interface. It’s a mechanism that allows two software components to communicate with each other through a set of definitions and protocols.

Simple analogy: Think of an API like a waiter in a restaurant. You (the client) tell the waiter what you want, the waiter takes your order to the kitchen (the server), and then brings back your food (the response).

Real example: A weather app on your phone doesn’t generate weather data itself. Instead, it uses a meteorological institute’s API to request daily weather information, which the API then provides.


APIs act as intermediaries. Here’s the basic flow:

  1. Client makes a request → “I need today’s weather for New York”
  2. API processes the request → Connects to the server and retrieves the data
  3. Server sends a response → Returns the weather information
  4. Client receives and displays data → Shows it in your app

REST API (Representational State Transfer)

Section titled “REST API (Representational State Transfer)”

Most popular and flexible type of API on the web today.

  • Client sends requests to the server as data (usually via HTTP)
  • Server processes the request and returns output data (typically JSON or XML)
  • Uses standard HTTP methods: GET, POST, PUT, DELETE
  • Example: GET https://api.weather.com/data/v1/current?city=NewYork

Why REST is popular: Simple, scalable, and works with any programming language.


  • Uses XML for message exchange between client and server
  • More rigid and structured than REST
  • Less flexible and heavier—mostly used in legacy enterprise systems
  • Still found in banking and payment systems due to high security standards

  • Client executes a function or procedure on the server
  • Server runs the function and returns the result
  • Example types: XML-RPC, JSON-RPC, gRPC
  • Faster than REST for specific use cases but less flexible

  • Enables bidirectional, real-time communication between client and server
  • Server can push messages to clients without waiting for requests
  • Uses JSON to transmit data
  • Perfect for: Chat applications, live notifications, gaming, stock trading platforms

Key difference from REST: Connection stays open, allowing continuous two-way communication instead of one request-response cycle.


FeatureREST APIWebSocket API