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

GraphQL API

  • Single Endpoint: A GraphQL API typically has a single endpoint through which all data is fetched.

  • Client-Driven Queries: The client specifies exactly what data it needs, which minimizes over-fetching (getting more data than needed) and under-fetching (not getting enough data).

  • Structured Responses: The response matches the request, allowing clients to shape the structure of the response to their needs.

  • Nested Queries: It supports complex nested data structures in a single request, which is useful for related data (e.g., querying a user and their posts).

  • No Versioning: GraphQL doesn’t require versioning because clients can request only the fields they need. As a result, new features can be added to an existing schema without breaking existing clients.

  • Error Reporting: GraphQL returns data and errors in the same response structure, so clients can still receive partial data when a non-fatal error occurs.

  • Strongly Typed Schema: GraphQL uses a type system to define the schema, so clients know what data and types are available. This can improve the development experience by enabling better tooling and validation.

Single Endpoint: /graphql

query {
  user(id: 1) {
    id
    name
    email
    posts {
      postId
      title
      content
    }
  }
}

Response:

{
  "data": {
    "user": {
      "id": 1,
      "name": "John Doe",
      "email": "john.doe@example.com",
      "posts": [
        {
          "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."
        }
      ]
    }
  }
}
PreviousREST APINextRPC (Remote Procedure Call)

Last updated 7 months ago

Was this helpful?