DEV Community

Cover image for Difference Between REST API and Normal API
aryan015
aryan015

Posted on

1

Difference Between REST API and Normal API

πŸš€ 1. πŸ”₯ What is a Normal API?

  • API (Application Programming Interface) is a generic term for any set of functions or methods that allow applications to communicate with each other.
  • It can be:
    • Local or remote.
    • Can use any protocol (HTTP, TCP, UDP, etc.).
  • Not restricted to web-based communication.
  • Examples:
    • Library API: Python’s math.sqrt() function.
    • Database API: MySQL Connector for interacting with a database.
    • System API: Linux system calls like read() or write().
    • Hardware API: DirectX for rendering graphics.

πŸ”₯ 2. βš™οΈ What is a REST API?

  • REST (Representational State Transfer) is a specific type of web API.
  • It follows the RESTful architecture and uses HTTP methods to interact with resources.
  • REST APIs:
    • Use stateless communication (each request is independent).
    • Use standard HTTP methods:
      • GET β†’ Retrieve data.
      • POST β†’ Create new data.
      • PUT/PATCH β†’ Update existing data.
      • DELETE β†’ Remove data.
    • Use JSON or XML for data exchange.
  • Examples:
    • GitHub REST API: To access GitHub data over HTTP.
    • OpenWeather API: For weather data retrieval.
    • Stripe API: For payment processing.

βš™οΈ 3. Key Differences:

Feature Normal API REST API
Scope Generic term for all APIs Specific type of web API
Protocol Uses any protocol (TCP, UDP, etc.) Uses HTTP/HTTPS only
State management Can be stateful or stateless Stateless by design
Data format Any format (binary, JSON, XML) Mostly JSON or XML
Methods Varies (no fixed methods) Uses standard HTTP methods
Communication Local or remote Web-based (remote) communication
Example File System API, Database API GitHub, Stripe, AWS S3 REST API

βœ… πŸ”₯ Final Takeaway:

  • Normal API: A broad term covering all APIs (local, web, database, etc.).
  • REST API: A specific type of web API that uses HTTP and follows RESTful principles.
  • All REST APIs are APIs, but not all APIs are RESTful. πŸš€

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

DEV shines when you're signed in, unlocking a customized experience with features like dark mode!

Okay