Skip to content

Kavyakb58/Student_Dummy_API_Postman

Repository files navigation

Student Dummy API

A simple Student Dummy API built using JSON Server, designed for learning and practicing API testing. This API supports CRUD operations (Create, Read, Update, Delete) on student data and is beginner-friendly for practice.

🚀 Features

  • Retrieve all student records
  • Retrieve a student record by ID
  • Add new student records
  • Update existing student records
  • Delete student records

📁 Repository Structure

student-dummy-api/
├── students.json        # Mock database containing student data
├── README.md            # Project documentation

✅ Pre-requisites

  • Node.js (JavaScript runtime)
  • npm (Node Package Manager, comes with Node.js)
  • JSON Server (Install via npm)

📥 How to Clone the Repository

  1. Open your terminal or command prompt.
  2. Run the following command to clone this repository:
git clone https://github.com/Kavyakb58/student-dummy-api.git
  1. Navigate to the project directory:
cd student-dummy-api

⚙️ Setup & Installation

1. Install JSON Server Globally

npm install -g json-server

2. Check Node.js and npm Installation

node -v
npm -v

▶️ How to Run the API

Start the JSON Server by running:

json-server --watch students.json

By default, the API will be running at:

http://localhost:3000/students

🌐 Available API Endpoints

Method Endpoint Description
GET /students Get all students
GET /students/:id Get a student by ID
POST /students Add a new student
PUT /students/:id Update entire student record
PATCH /students/:id Partially update student record
DELETE /students/:id Delete a student record

💬 Example API Requests

Example POST (Add Student)

POST /students
{
  "name": "Alice",
  "location": "UK",
  "phone": "9876543210",
  "courses": ["JavaScript", "Node.js"]
}

Example PUT (Update Student)

PUT /students/1
{
  "name": "John Updated",
  "location": "India",
  "phone": "1234567890",
  "courses": ["Java", "Selenium"]
}

Example PATCH (Partial Update)

PATCH /students/1
{
  "phone": "1112223334"
}

Example DELETE (Remove Student)

DELETE /students/1

📬 How to Use in Postman

  1. Open Postman application.
  2. Set the request method (GET, POST, PUT, PATCH, DELETE).
  3. Enter the API URL, for example:
http://localhost:3000/students
  1. For POST, PUT, PATCH requests, go to the Body tab, select raw, and choose JSON format. Enter JSON data like shown above.
  2. Click Send to perform the operation and view the response.

📜 License

This project is licensed under the MIT License.

About

A dummy Student API built using Node.js and JSON Server for practicing CRUD operations and API testing using Postman.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors