API Understanding
API (Application Programming Interface) is a way for two software systems to talk to each other.
Think of it like a restaurant 🍽️
-
You = client (frontend / app)
-
Kitchen = server (database / backend)
-
Waiter = API
You ask for food → waiter takes request → kitchen prepares → waiter brings response.
In tech terms:
-
You send a request
-
API processes it
-
API sends back a response (data)
REST (Representational State Transfer) is a set of rules for building APIs in a clean, standard way.
A RESTful API:
-
Uses HTTP methods
-
Works with URLs
-
Sends data usually in JSON
-
Is stateless (each request is independent)
-
Simple & predictable
-
Easy to use with frontend (React, mobile apps)
-
Scalable
-
Works over the internet using HTTP
-
Python 3.x
-
Flask
Use Postman or browser:
-
GET http://127.0.0.1:5000/students
-
GET http://127.0.0.1:5000/students/1
-
POST http://127.0.0.1:5000/students
-
DELETE http://127.0.0.1:5000/students/1
Project Title:
Understanding APIs and RESTful APIs using Python (Flask)
Submitted By:
(Your Name)
Course:
(Your Course Name)
Institution:
(College Name)
Academic Year:
(Year)
This project focuses on understanding Application Programming Interfaces (APIs) and RESTful APIs by designing and implementing a simple REST API using Python Flask. The project demonstrates how data can be exchanged between a client and server using HTTP methods such as GET, POST, and DELETE.
📚 1. IntroductionIn modern web development, APIs play a crucial role in enabling communication between different software systems. RESTful APIs are widely used because they are simple, scalable, and platform-independent. This project aims to provide a basic understanding of APIs and REST architecture through hands-on implementation.
🌐 2. What is an API?An API (Application Programming Interface) allows different software applications to communicate with each other. It acts as an intermediary that receives requests and returns responses in a structured format, usually JSON.
🔁 3. What is a RESTful API?REST (Representational State Transfer) is an architectural style for designing networked applications. A RESTful API uses standard HTTP methods and URLs to perform CRUD (Create, Read, Update, Delete) operations.
REST Principles:-
Stateless communication
-
Client-server architecture
-
Resource-based URLs
-
Use of HTTP methods
-
Programming Language: Python
-
Framework: Flask
-
Data Format: JSON
-
Testing Tool: Postman / Browser
The project implements a Student Management REST API that allows users to:
-
Retrieve all students
-
Retrieve a student by ID
-
Add a new student
-
Delete an existing student
The API stores data in a temporary in-memory list, simulating a database.
⚙️ 7. System ImplementationThe Flask framework is used to define routes and handle HTTP requests. Each endpoint corresponds to a specific operation and returns JSON responses.