<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ranit Saha</title>
    <description>The latest articles on Forem by Ranit Saha (@coderooz).</description>
    <link>https://forem.com/coderooz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1978653%2Feb1d9211-4757-4b26-80dc-52054f2c8f4a.jpg</url>
      <title>Forem: Ranit Saha</title>
      <link>https://forem.com/coderooz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/coderooz"/>
    <language>en</language>
    <item>
      <title>How APIs Work: A Beginner-Friendly Guide to REST, GraphQL, Authentication &amp; More</title>
      <dc:creator>Ranit Saha</dc:creator>
      <pubDate>Tue, 24 Feb 2026 15:41:35 +0000</pubDate>
      <link>https://forem.com/coderooz/how-apis-work-a-beginner-friendly-guide-to-rest-graphql-authentication-more-2kgf</link>
      <guid>https://forem.com/coderooz/how-apis-work-a-beginner-friendly-guide-to-rest-graphql-authentication-more-2kgf</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Every modern application relies on APIs.&lt;/p&gt;

&lt;p&gt;From weather apps and payment systems to AI-powered tools like ChatGPT — everything communicates through APIs behind the scenes.&lt;/p&gt;

&lt;p&gt;Yet many developers use APIs daily without fully understanding how they actually work.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll break down APIs from first principles — including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The request–response cycle&lt;/li&gt;
&lt;li&gt;Types of APIs (REST, GraphQL, SOAP)&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Rate limiting&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s simplify it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is an API?
&lt;/h2&gt;

&lt;p&gt;API stands for &lt;strong&gt;Application Programming Interface&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At its core, an API is a &lt;strong&gt;contract between two systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It defines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How a client asks for something&lt;/li&gt;
&lt;li&gt;How a server responds&lt;/li&gt;
&lt;li&gt;What format the data must follow&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;APIs are not magic. They are structured communication rules.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Request–Response Cycle (The Core Concept)
&lt;/h2&gt;

&lt;p&gt;Every API interaction follows the same pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;client sends a request&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;server processes it&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;server sends a response&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;client uses the response&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This happens every time you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to an app&lt;/li&gt;
&lt;li&gt;Refresh a page&lt;/li&gt;
&lt;li&gt;Submit a form&lt;/li&gt;
&lt;li&gt;Check the weather&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The entire modern web runs on this cycle.&lt;/p&gt;




&lt;h1&gt;
  
  
  Types of APIs You’ll Encounter
&lt;/h1&gt;

&lt;p&gt;Not all APIs are designed the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  REST APIs (Representational State Transfer)
&lt;/h2&gt;

&lt;p&gt;REST is the most widely used API style on the web.&lt;/p&gt;

&lt;p&gt;It relies on standard HTTP methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GET&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;POST&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PUT&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DELETE&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data is typically exchanged in &lt;strong&gt;JSON format&lt;/strong&gt;, making REST lightweight and easy to work with.&lt;/p&gt;

&lt;p&gt;Most web and mobile applications rely on REST APIs.&lt;/p&gt;




&lt;h2&gt;
  
  
  GraphQL APIs
&lt;/h2&gt;

&lt;p&gt;GraphQL allows the client to request &lt;strong&gt;exactly the data it needs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Unlike REST — where the server defines the structure — GraphQL gives more control to the client.&lt;/p&gt;

&lt;p&gt;This helps reduce over-fetching and under-fetching of data.&lt;/p&gt;




&lt;h2&gt;
  
  
  SOAP APIs
&lt;/h2&gt;

&lt;p&gt;SOAP (Simple Object Access Protocol) is older and more rigid.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses &lt;strong&gt;XML&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Strict standards&lt;/li&gt;
&lt;li&gt;Strong built-in security&lt;/li&gt;
&lt;li&gt;Common in enterprise systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More formal. More structured. More verbose.&lt;/p&gt;




&lt;h1&gt;
  
  
  Public APIs vs Internal APIs
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Public APIs
&lt;/h2&gt;

&lt;p&gt;Public APIs are exposed to external developers.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Payment APIs&lt;/li&gt;
&lt;li&gt;Weather APIs&lt;/li&gt;
&lt;li&gt;Cloud storage APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They allow third-party applications to integrate services.&lt;/p&gt;




&lt;h2&gt;
  
  
  Internal APIs
&lt;/h2&gt;

&lt;p&gt;Internal APIs are used within an organization.&lt;/p&gt;

&lt;p&gt;They are not exposed publicly.&lt;/p&gt;

&lt;p&gt;They help teams:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintain scalability&lt;/li&gt;
&lt;li&gt;Improve communication between systems&lt;/li&gt;
&lt;li&gt;Structure internal services&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  How APIs Work in Real Applications
&lt;/h1&gt;

&lt;p&gt;At a basic level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;client&lt;/strong&gt; sends a request&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;server&lt;/strong&gt; processes it&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;server&lt;/strong&gt; returns data (or an error)&lt;/li&gt;
&lt;li&gt;The client updates the UI or performs an action&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The language you use (JavaScript, Python, etc.) may differ — but the underlying concept remains the same.&lt;/p&gt;




&lt;h1&gt;
  
  
  Authentication (Proving Who You Are)
&lt;/h1&gt;

&lt;p&gt;APIs don’t allow unlimited anonymous access.&lt;/p&gt;

&lt;p&gt;They verify identity using:&lt;/p&gt;

&lt;h2&gt;
  
  
  API Keys
&lt;/h2&gt;

&lt;p&gt;Simple unique identifiers sent with requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  OAuth
&lt;/h2&gt;

&lt;p&gt;A secure method that allows apps to access data without exposing credentials.&lt;/p&gt;

&lt;p&gt;If you’ve used “Sign in with Google,” you’ve used OAuth.&lt;/p&gt;

&lt;p&gt;Authentication protects systems from misuse and tracks usage.&lt;/p&gt;




&lt;h1&gt;
  
  
  Rate Limiting (Preventing Abuse)
&lt;/h1&gt;

&lt;p&gt;Rate limiting controls how often an API can be used.&lt;/p&gt;

&lt;p&gt;If a client sends too many requests too quickly, the server may respond with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;429 – Too Many Requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps systems stable and fair for all users.&lt;/p&gt;




&lt;h1&gt;
  
  
  Error Codes (Understanding What Happened)
&lt;/h1&gt;

&lt;p&gt;APIs communicate results using status codes.&lt;/p&gt;

&lt;p&gt;Some indicate success.&lt;br&gt;
Others indicate failure.&lt;/p&gt;

&lt;p&gt;Status codes remove guesswork and provide standardized communication.&lt;/p&gt;

&lt;p&gt;Understanding them is essential for debugging effectively.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Understanding APIs Matters
&lt;/h1&gt;

&lt;p&gt;APIs are foundational to backend development.&lt;/p&gt;

&lt;p&gt;If you understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Request–response flow&lt;/li&gt;
&lt;li&gt;API types&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Rate limiting&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You understand how modern software systems communicate.&lt;/p&gt;

&lt;p&gt;That’s not just theory — that’s real-world architecture.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;APIs can seem complex at first.&lt;/p&gt;

&lt;p&gt;But when broken down step-by-step, they follow predictable patterns.&lt;/p&gt;

&lt;p&gt;Mastering API fundamentals builds a strong backend foundation — and makes learning advanced topics much easier.&lt;/p&gt;




&lt;p&gt;If you want the full expanded version with detailed explanations and examples, you can read it here:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://www.coderooz.in/content/apis-explained-for-developers" rel="noopener noreferrer"&gt;https://www.coderooz.in/content/apis-explained-for-developers&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>api</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
