Anandi Sheladiya
Contact
  • About Anandi
  • SKILLS & EXPERIENCE
    • Frontend
      • ReactJS
      • Next.js – The React Framework for Production
      • ChartJS / D3.JS / Fabric JS
      • Three.JS: The JavaScript Library for 3D Graphics
      • HTML/CSS/JS/Tailwind CSS/Bootstrap
      • Material UI – The Ultimate React UI Framework
      • ShadCN/UI – The Modern UI Library for React
    • Backend
      • NodeJS & ExpressJS
      • Web3.JS
      • Python & Django
      • GoLang
      • TypeScript
    • Database
      • PostgreSQL
      • MongoDB - NOSQL Database
      • MySQL
    • API
      • REST API
      • GraphQL API
      • RPC (Remote Procedure Call)
      • WebSocket
    • Solidity
    • Layer 1 Blockchain
      • Ethereum
      • Solana
      • Bitcoin
      • Hyperledger
      • Binance
      • Avalanche
      • Cardano
      • Polkadot
      • Near Protocol
      • Algorand
      • TON (Telegram Open Network)
    • Optimistic Rollups (L2 on Ethereum)
      • Arbitrum
      • Base
      • Mantle
    • ZK-Rollups (L2 on Ethereum)
      • zkSync Era
      • Polygon zkEVM
    • Wallet Integration
      • Reown Appkit
      • Rainbow Walletkit
      • Web3 Modal
      • WalletConnect
      • Wagmi
      • Metamask & Safewallet SDKs
    • Web3 SDKs & API Providers
      • Alchemy
      • Moralis
      • QuickNode
      • BitQuery API & Stream
      • ThirdWeb
      • Infura
      • Li.Fi
      • 1Inch API
      • Uniswap API
      • OpenZeppelin
    • Web3 Middleware/ UX Infrastructure Platform
      • Biconomy
      • Pimlico
      • Alchemy AA
      • Safe (formerly Gnosis Safe)
      • ZeroDev
    • On Chain Trading Platform & Telegram Bot
      • Bullx
      • Wave Bot
      • GMGN
      • Shuriken
      • Magnum Trade
      • Trojan
  • PROTOCOLS
    • ERCs & EIPs
      • ERC-20: The Standard for Fungible Tokens
      • ERC-721: The Standard for Non-Fungible Tokens (NFTs)
      • ERC 4337
      • ERC 6551: Token Bound Accounts (TBA)
      • ERC 7702
      • EIP 4844 (Proto-Danksharding)
      • Ethereum Pectra
  • ARTICLES
    • Medium
Powered by GitBook
On this page

Was this helpful?

  1. SKILLS & EXPERIENCE
  2. API

REST API

  • Multiple Endpoints: A REST API usually has different endpoints for different resources (e.g., /users, /orders).

  • Fixed Data Structure: The server determines the structure and amount of data returned, which can sometimes result in over-fetching or under-fetching.

  • Predefined Responses: Each endpoint returns a fixed set of data, and customizing the response requires modifying the endpoint or adding new one

  • Less Flexible: Clients typically receive a full resource representation, and changes to the data format may require updates to the server or API versioning.

  • Multiple Requests: Nested or related data often requires multiple API calls, potentially leading to performance inefficiencies.

  • Versioning Required: REST often uses versioning (e.g., /api/v1/) to manage changes and avoid breaking existing clients. This can lead to version sprawl over time.

  • Separate Error Responses: Errors are usually returned in different HTTP status codes (e.g., 404, 500), making it simpler but also less flexible in terms of combining partial data with errors.

  • No Type System: REST APIs do not inherently include a type system. JSON Schema or similar tools can be used, but they are not part of the REST standard.

REST API Example

  • Endpoint 1: /users/1 (to get user details)

  • Endpoint 2: /users/1/posts (to get the user's posts)

  1. Request 1 (Get user details):

GET /users/1

Response:

{
  "id": 1,
  "name": "John Doe",
  "email": "john.doe@example.com"
}
  1. Request 2 (Get user's posts):

GET /users/1/posts

Response:

[
  {
    "postId": 101,
    "title": "My first post",
    "content": "This is the content of my first post."
  },
  {
    "postId": 102,
    "title": "Another day, another post",
    "content": "Here's some more content."
  }
]
PreviousAPINextGraphQL API

Last updated 7 months ago

Was this helpful?