Facebook Instagram Twitter Vimeo Youtube
Sign in
  • Home
  • About
  • Team
  • Buy now!
Sign in
Welcome!Log into your account
Forgot your password?
Privacy Policy
Password recovery
Recover your password
Search
Logo
Sign in
Welcome! Log into your account
Forgot your password? Get help
Privacy Policy
Password recovery
Recover your password
A password will be e-mailed to you.
Thursday, September 4, 2025
Sign in / Join
  • Contact Us
  • Our Team
Facebook
Instagram
Twitter
Vimeo
Youtube
Logo
  • Home
  • News
    • News

      Anthropic Confirms Claude AI Was Weaponized in Major Cyberattacks by Husain Parvez

      3 September 2025
      News

      Over 30,000 Malicious IPs Target Microsoft Remote Desktop in Global Surge by Husain Parvez

      31 August 2025
      News

      Cyber Threat-Sharing Law Nears Expiration: Experts Warn of Risks by Husain Parvez

      31 August 2025
      News

      North Korean Hacking Tools Leak Online, Including Advanced Linux Rootkit by Paige Henley

      28 August 2025
      News

      iiNet Cyberattack Exposes Data of 280,000 Customers by Husain Parvez

      28 August 2025
  • Data Modelling & AI
    • AllBig dataBusiness AnalyticsData ScienceData Structure & AlgorithmDatabasesVector DatabaseDeep LearningEthical HackingGenerative AIMachine Learning
      Big data

      LangExtract + Milvus: A Practical Guide to Building a Hybrid Document Processing and Search System

      30 August 2025
      Big data

      Stop Your AI Assistant from Writing Outdated Code with Milvus SDK Code Helper

      26 August 2025
      Big data

      A Practical Guide for Choosing the Right Vector Database for Your AI Applications

      26 August 2025
      Big data

      Why I’m Against Claude Code’s Grep-Only Retrieval? It Just Burns Too Many Tokens

      26 August 2025
    • Big data
    • Business Analytics
    • Databases
    • Data Structure & Algorithm
    • Data Science
    • Deep Learning
    • Ethical Hacking
    • Generative AI
    • Machine Learning
    • Security & Testing
  • Mobile
    • AllAndroidIOS
      Android

      It’s your last chance to score a $50 Samsung credit before tomorrow’s big product announcement

      4 September 2025
      Android

      The Samsung Health app now puts a licensed doctor right in your pocket

      3 September 2025
      Android

      Google’s NotebookLM is giving Audio Overviews new personalities

      3 September 2025
      Android

      MediaTek’s next flagship chip may give future Android phones faster cores and a beefed-up NPU

      3 September 2025
    • Android
    • IOS
  • Languages
    • AllAjaxAngularDynamic ProgrammingGolangJavaJavascriptPhpPythonReactVue
      Languages

      Working with Titles and Heading – Python docx Module

      25 June 2025
      Languages

      Creating a Receipt Calculator using Python

      25 June 2025
      Languages

      One Liner for Python if-elif-else Statements

      25 June 2025
      Languages

      Add Years to datetime Object in Python

      25 June 2025
    • Java
    • Python
  • Guest Blogs
  • Discussion
  • Our Team
HomeData Modelling & AIBig dataWhat’s an API?
Big dataGuest Blogs

What’s an API?

Algomaster
By Algomaster
15 June 2025
0
0
Share
Facebook
Twitter
Pinterest
WhatsApp

    What’s an API?

    what every tech company has in common

    Ashish Pratap Singh's avatar

    Ashish Pratap Singh
    Jan 21, 2025

    API stands for Application Programming Interface.

    At its core, an API is a bunch of code that takes an input and gives you predictable outputs.

    Think of an API as a middleman that enables applications to interact without needing direct access to each other’s code or database.

    Almost every digital service you use today—social media, e-commerce, online banking, ride-hailing apps—all of them are a bunch of APIs working together.

    Examples:

    • Weather API – If you provide a city name as input ("New York"), the API returns the current temperature, humidity, and weather conditions.

    • Uber Ride API – If you provide a pickup and destination address, the API finds the nearest available driver and calculates the estimated fare.

    • Python’s sorted() API – If you provide a list of numbers ([5, 3, 8, 1]), the API returns the sorted list ([1, 3, 5, 8]).

    When engineers build APIs, they clearly define what inputs the API accepts and what outputs it produces, ensuring consistent behavior across different applications.

    APIs follow a simple request-response model:

    • A client (such as a web app or mobile app) makes a request to an API.

    • The API (hosted on an API server) processes the request, interacts with the necessary databases or services, and prepares a response.

    • The API sends the response back to the client in a structured format (usually JSON or XML).

    Inputs

    Every API requires specific types of inputs, and passing incorrect data can result in errors.

    For example: If you tried putting your name into the Google Maps API as an input, that wouldn’t work very well.

    Some APIs also require inputs in a specific format.

    Example: The Currency Exchange API might need the input as "USD_TO_EUR" instead of "usd to euro".

    APIs often validate inputs to ensure they are correct before processing them, which helps maintain accuracy and security.

    Outputs

    Just as APIs require specific inputs, they also return well-structured outputs.

    For example, the Google Maps API always returns coordinates in the same format.

    {   
      "latitude": 40.6892,   
      "longitude": -74.0445 
    }

    If the API can’t find the location, it provides an error response explaining why.

    {
      "error": "Invalid address format",
      "code": 400 
    }

    If you’re finding this newsletter valuable and want to deepen your learning, consider becoming a paid subscriber.

    As a paid subscriber, you’ll receive an exclusive deep-dive article every week, access to a structured System Design Resource (100+ topics and interview questions), and other premium perks.

    Unlock Full Access


    1. How APIs Power Modern Applications

    The apps you use every day—whether it’s Gmail, Instagram, Uber, or Spotify—are essentially a collection of APIs with a polished user interface (UI) on top.

    Most applications follow the frontend/backend architecture, where:

    • The backend consists of APIs that handle data processing, business logic, and communication with databases.

    • The frontend is a graphical user interface (GUI) that interacts with these APIs, making applications user-friendly and accessible without requiring users to write code.

    Let’s break this down with a real-world example: Uber.

    The Backend

    Before the Uber app existed as a sleek, user-friendly experience, the company first built the core APIs that power ride-hailing services:

    • Finding Nearby Drivers

    • Calculating Fares & Routes

    • Process Payment

    • Real-Time Tracking

    • Matching Riders & Drivers

    These APIs run on Uber’s servers, forming the backend infrastructure. Every time you request a ride, track your driver, or make a payment, these backend APIs handle the request.

    Backend engineers are responsible for optimizing these APIs, improving ride-matching algorithms, securing transactions, and ensuring a smooth experience for millions of users.

    The Frontend

    The backend APIs handle all the complex logic, but they only work through code—which isn’t practical for everyday users. That’s why companies build a frontend (user interface) on top of these APIs, allowing users to interact with the system visually and intuitively.

    Example: When you enter your pickup & destination address, the frontend sends an API request to find nearby drivers and displays available cars.

    Once the trip is complete, the frontend may call the process payment API to display the receipt.

    Share


    2. Types of APIs

    APIs come in different forms depending on who can access them, how they are used, and what purpose they serve.

    1. Open APIs (Public APIs)

    Open APIs, also known as Public APIs, are accessible to external developers with minimal restrictions.

    Companies provide these APIs to encourage third-party developers to integrate their services and build new applications on top of them.

    Example: YouTube Data API

    Normally, when you use the YouTube app, it makes internal API calls to fetch your video feed, search for content, or post comments. However, YouTube also provides a public API that allows developers to access some of this functionality outside of the app.

    For example, the YouTube Search API allows developers to fetch video results based on a keyword. If you send a request to the API with "machine learning tutorial" as the search term, it will return a structured response (JSON format) containing a list of relevant videos, including titles, descriptions, thumbnails, and video links.

    This is incredibly useful because it enables developers to build custom applications on top of YouTube.

    2. Internal APIs (Private APIs)

    Internal APIs, also known as Private APIs, are designed exclusively for internal use within an organization. Unlike Open APIs, these are not accessible to external developers and are used to facilitate seamless communication between different internal systems within a company.

    Let’s take Amazon as an example. When you place an order, you might assume that a single system processes your request. In reality, multiple internal APIs (order processing, inventory, payment, logistics etc..) work together behind the scenes to fulfill your order efficiently.

    Each of these APIs operates independently, but they communicate through well-defined protocols to ensure a smooth and efficient process.

    Internal APIs allow companies to break down their applications into smaller, manageable services, making it easier to scale. Developers can reuse internal APIs across different projects, reducing duplication and speeding up development.

    3. Code Interfaces

    The first two types of APIs we discussed—Open APIs and Internal APIs—are functional and serve real-world use cases like fetching weather data or booking a ride.

    But there’s another category of APIs that developers use daily: Code Interfaces (also called Library APIs or Programming APIs).

    These APIs don’t connect different applications; instead, they provide predefined functions within a programming language or framework to make development easier.

    Example: Python’s built-in list API

    When working with lists, Python provides a set of built-in functions (methods) to manipulate data.

    numbers = [5, 3, 8, 1, 4] numbers.sort()  # API call to sort the list  
    fruits = ["apple", "banana"]
    fruits.append("orange")  # API call to add an element
    fruits.pop()  # API call to remove the last element

    Instead of writing sorting algorithms from scratch, developers can use sort() or sorted() in Python.

    Code APIs are not just limited to built-in programming language functions. Take TensorFlow, an AI/ML library. It provides a high-level API for training machine learning models without needing to implement complex mathematical operations from scratch.

    For example, creating a neural network using TensorFlow’s API is as simple as:

    import tensorflow as tf model = tf.keras.Sequential([tf.keras.layers.Dense(64, activation="relu")])

    Programming APIs abstract away complexity so that developers can focus on building solutions rather than reinventing the wheel.


    3. API Communication Methods

    APIs communicate using different protocols and architectures that define how requests are sent, how responses are formatted, and how data is exchanged between systems.

    1. REST (Representational State Transfer)

    REST is the most widely used API communication method today. It is lightweight, stateless, and scalable, making it perfect for web services and mobile applications.

    REST APIs follow a set of design principles and use HTTP methods (GET, POST, PUT, DELETE) to perform operations.

    REST APIs are based on resources, and each resource is accessed through a URL (endpoint). The API follows the client-server model, meaning the client sends a request, and the server processes it and sends a response.

    Example: REST API for a Bookstore

    Retrieve a list of books (GET Request):

    GET https://api.bookstore.com/books

    Response (JSON):

    [
      {
        "id": 1,
        "title": "Clean Code",
        "author": "Robert C. Martin"
      },
      {
        "id": 2,
        "title": "The Pragmatic Programmer",
        "author": "Andrew Hunt"
      }
    ]

    2. SOAP (Simple Object Access Protocol)

    SOAP is an older API communication method that relies on XML-based messaging.

    Unlike REST, which is lightweight, SOAP is more structured and secure, making it ideal for banking, healthcare, and enterprise applications.

    SOAP messages are sent using XML format and require a WSDL (Web Services Description Language) file, which defines the API’s available functions and request structure.

    Example: SOAP API for a Banking Service

    Request: Fetching account balance

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bank="http://bank.example.com/">
      <soapenv:Header/>
      <soapenv:Body>
        <bank:GetAccountBalance>
          <bank:accountNumber>123456</bank:accountNumber>
        </bank:GetAccountBalance>
      </soapenv:Body>
    </soapenv:Envelope>

    Response:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bank="http://bank.example.com/">
      <soapenv:Body>
        <bank:GetAccountBalanceResponse>
          <bank:balance>5000.00</bank:balance>
        </bank:GetAccountBalanceResponse>
      </soapenv:Body>
    </soapenv:Envelope>

    3. GraphQL

    GraphQL is an alternative to REST that allows clients to request exactly the data they need, making it more efficient for modern applications. Unlike REST, which requires multiple API calls to fetch related data, GraphQL can fetch all necessary data in a single request.

    Instead of predefined endpoints, GraphQL exposes a single API endpoint, and the client sends queries to request specific fields.

    Example: Fetching a user’s profile and their recent posts in a single request.

    {
      user(id: 123) {
        name
        email
        posts {
          title
          likes
        }
      }
    }

    Response:

    {
      "data": {
        "user": {
          "name": "Alice",
          "email": "alice@example.com",
          "posts": [
            {
              "title": "Hello World",
              "likes": 100
            },
            {
              "title": "GraphQL is Amazing!",
              "likes": 200
            }
          ]
        }
      }
    }

    4. gRPC

    gRPC (Google Remote Procedure Call) is a high-performance API communication method that uses Protocol Buffers (Protobuf) instead of JSON or XML, making it faster and more efficient.

    gRPC uses binary data format instead of text-based formats, reducing payload size and it supports bidirectional streaming, meaning the client and server can send data at the same time.


    4. How to Use an API (Step-by-Step Guide)

    Using an API might seem complex at first, but it follows a simple request-response pattern.

    Here’s a guide on how to find, access, and interact with an API step by step:

    Step 1: Find an API to Use

    Before using an API, you need to identify the right API for your needs. APIs are available for different services like weather data, finance, social media, etc.

    Where to Find APIs?

    Public API directories:

    • RapidAPI – A marketplace for APIs with free & paid options.

    • Postman API Network – A collection of public APIs.

    • API List – A fun list of free public APIs.

    • GitHub’s Public API List – Open-source API collection.

    Official API Documentation:

    • Google APIs

    • X API

    • OpenWeather API

    Step 2: Read the API Documentation

    API documentation explains how to use the API, available endpoints, authentication, and response formats.

    Example: The OpenWeatherMap API

    The OpenWeatherMap API allows users to fetch real-time weather data. Here’s a breakdown of its key components:

    API URL

    https://api.openweathermap.org/data/3.0/weather?q=city_name&appid=YOUR_API_KEY

    Required Parameters:

    • q: City name (e.g., London)

    • appid: API Key (required for access)

    Step 3: Get API Access (API Key / Authentication)

    Most APIs require authentication to prevent unauthorized access and manage usage limits.

    Common Authentication Methods:

    • API Key – A unique key provided by the API service

    • OAuth 2.0 – Secure login via Google, Github, etc.

    • JWT (JSON Web Token): Token-based authentication

    • Basic Authentication: Username + password (Base64 encoded)

    Example: Getting an API Key (OpenWeather API)

    • Sign up at https://home.openweathermap.org/users/sign_up.

    • Go to the API keys section and generate a key.

    • Use the API key in requests:

    GET https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY

    Step 4: Test the API Using Postman or cURL

    Before writing code, test the API to see how it responds.

    Option 1: Using Postman (Recommended for Beginners)

    • Download & install Postman.

    • Click “New Request”, enter the API endpoint URL (https://api.openweathermap.org/data/3.0/weather?q=London&appid=YOUR_API_KEY).

    • Select GET as the HTTP method.

    • Click “Send” and view the response in JSON format.

    Option 2: Using cURL (For Command Line Users)

    You can also test APIs directly from the command line using cURL.

    curl -X GET "https://api.openweathermap.org/data/3.0/weather?q=New+York&appid=YOUR_API_KEY"

    Step 5: Write Code to Call the API

    Now that you’ve tested the API, it’s time to integrate it into your application.

    Example: Calling an API in Python

    import requests
    
    API_KEY = "YOUR_API_KEY"
    CITY = "New York"
    
    url = f"https://api.openweathermap.org/data/3.0/weather?q={CITY}&appid={API_KEY}"
    
    response = requests.get(url)
    
    if response.status_code == 200:
        data = response.json()
        temperature = data['main']['temp']
        print(f"Current temperature in {CITY}: {temperature}°C")
    else:
        print(f"Error retrieving data: Status code {response.status_code}")
    • requests.get(url) – Sends an API request.

    • response.json() – Converts response to JSON.

    • if response.status_code == 200 – Checks if the request was successful.

    Step 6: Handle Errors & Rate Limits

    APIs don’t always return perfect responses. You should handle:

    • Invalid inputs (e.g., wrong city name).

    • Authentication errors (e.g., expired API keys).

    • Rate limits (e.g., exceeding request limits).

    Example: Handling API Errors in Python

    import requests
    
    API_KEY = "YOUR_API_KEY"
    CITY = "New York"
    
    url = f"https://api.openweathermap.org/data/3.0/weather?q={CITY}&appid={API_KEY}"
    
    response = requests.get(url)
    
    if response.status_code == 200:
        data = response.json()
        weather_description = data['weather'][0]['description']
        print(f"Current weather in {CITY}: {weather_description}")
    elif response.status_code == 401:
        print("Error: Invalid API key")
    elif response.status_code == 404:
        print("Error: City not found")
    else:
        print(f"Unexpected error occurred: Status code {response.status_code}")

    Step 7: Use API Responses in Your Application

    Once you fetch data from an API, you can display it dynamically in a web or mobile app.

    Example: You can build a weather dashboard using the OpenWeatherMap API.

    • Fetch live weather data from the API.

    • Parse and extract relevant details (temperature, humidity, condition).

    • Display the weather report in a user-friendly format.


    Thank you for reading!

    If you found it valuable, hit a like ❤️ and consider subscribing for more such content every week.

    If you have any questions or suggestions, leave a comment.

    This post is public so feel free to share it.

    Share


    P.S. If you’re finding this newsletter helpful and want to get even more value, consider becoming a paid subscriber.

    As a paid subscriber, you’ll receive an exclusive deep dive every week, access to a comprehensive system design learning resource , and other premium perks.

    Get full access to AlgoMaster

    There are group discounts, gift options, and referral bonuses available.


    Checkout my Youtube channel for more in-depth content.

    Follow me on LinkedIn, X and Medium to stay updated.

    Checkout my GitHub repositories for free interview preparation resources.

    I hope you have a lovely day!

    See you soon,
    Ashish

    Share
    Facebook
    Twitter
    Pinterest
    WhatsApp
      Previous article
      Long Polling vs WebSockets
      Next article
      Master the Art of REST API Design
      Algomaster
      Algomasterhttps://blog.algomaster.io
      RELATED ARTICLES
      Guest Blogs

      7 Best 123Movies Alternatives in 2025: Free & Safe Sites by Ivan Stevanovic

      3 September 2025
      Guest Blogs

      Interview with Tyson Garrett – CTO of TrustOnCloud – Making Cloud Threat Modeling Executable by Shauli Zacks

      2 September 2025
      Big data

      LangExtract + Milvus: A Practical Guide to Building a Hybrid Document Processing and Search System

      30 August 2025

      LEAVE A REPLY Cancel reply

      Log in to leave a comment

      Most Popular

      It’s your last chance to score a $50 Samsung credit before tomorrow’s big product announcement

      4 September 2025

      The Samsung Health app now puts a licensed doctor right in your pocket

      3 September 2025

      Google’s NotebookLM is giving Audio Overviews new personalities

      3 September 2025

      MediaTek’s next flagship chip may give future Android phones faster cores and a beefed-up NPU

      3 September 2025
      Load more
      Algomaster
      Algomaster
      202 POSTS0 COMMENTS
      https://blog.algomaster.io
      Calisto Chipfumbu
      Calisto Chipfumbu
      6637 POSTS0 COMMENTS
      http://cchipfumbu@gmail.com
      Dominic
      Dominic
      32260 POSTS0 COMMENTS
      http://wardslaus.com
      Milvus
      Milvus
      81 POSTS0 COMMENTS
      https://milvus.io/
      Nango Kala
      Nango Kala
      6625 POSTS0 COMMENTS
      neverop
      neverop
      0 POSTS0 COMMENTS
      https://geeksforgeeks.org
      Nicole Veronica
      Nicole Veronica
      11795 POSTS0 COMMENTS
      Nokonwaba Nkukhwana
      Nokonwaba Nkukhwana
      11855 POSTS0 COMMENTS
      Safety Detectives
      Safety Detectives
      2594 POSTS0 COMMENTS
      https://www.safetydetectives.com/
      Shaida Kate Naidoo
      Shaida Kate Naidoo
      6747 POSTS0 COMMENTS
      Ted Musemwa
      Ted Musemwa
      7023 POSTS0 COMMENTS
      Thapelo Manthata
      Thapelo Manthata
      6694 POSTS0 COMMENTS
      Umr Jansen
      Umr Jansen
      6714 POSTS0 COMMENTS

      EDITOR PICKS

      It’s your last chance to score a $50 Samsung credit before tomorrow’s big product announcement

      4 September 2025

      The Samsung Health app now puts a licensed doctor right in your pocket

      3 September 2025

      Google’s NotebookLM is giving Audio Overviews new personalities

      3 September 2025

      POPULAR POSTS

      It’s your last chance to score a $50 Samsung credit before tomorrow’s big product announcement

      4 September 2025

      The Samsung Health app now puts a licensed doctor right in your pocket

      3 September 2025

      Google’s NotebookLM is giving Audio Overviews new personalities

      3 September 2025

      POPULAR CATEGORY

      • Languages45985
      • Data Modelling & AI17566
      • Java15156
      • Android14049
      • Mobile12983
      • Javascript12713
      • Guest Blogs12669
      • Data Structure & Algorithm10077
      Logo

      ABOUT US

      We provide you with the latest breaking news and videos straight from the technology industry.

      Contact us: hello@geeksforgeeks.org

      FOLLOW US

      Blogger
      Facebook
      Flickr
      Instagram
      VKontakte

      © NeverOpen 2022

      • Home
      • News
      • Data Modelling & AI
      • Mobile
      • Languages
      • Guest Blogs
      • Discussion
      • Our Team