API Reference Docs
GET
/students
List all students (supports filtering by branch & keyword search).
Query Parameters
| Param | Type | Description |
|---|---|---|
| id | integer | Optional. Specific student ID to fetch. |
| branch | string | Optional. Filter students by exact branch matching. |
| search | string | Optional. Substring search matching on Name or USN. |
curl -X GET "http://localhost:8000/students"
fetch('http://localhost:8000/students')
.then(response => response.json())
.then(data => console.log(data));
GET
/students?id={id}
Fetch a single student information by their ID.
Query Parameters
| Param | Type | Description |
|---|---|---|
| id | integer | Required. Specific student ID to fetch. |
curl -X GET "http://localhost:8000/students?id=1"
fetch('http://localhost:8000/students?id=1')
.then(response => response.json())
.then(data => console.log(data));
POST
/students (Create)
Create a new student entry (Accepts JSON body).
JSON Fields
| Field | Type | Requirement | Description |
|---|---|---|---|
| name | string | Required | Full name of the student. |
| usn | string | Required (Unique) | USN Number (e.g. CS24001). Must be unique. |
| branch | string | Required | Branch of study (e.g. CSE). |
| semester | integer | Required | Semester of study. Must be between 1 and 8. |
curl -X POST "http://localhost:8000/students" \
-H "Content-Type: application/json" \
-d '{"usn": "CS24001", "name": "John Cena", "branch": "CSE", "semester": 7}'
fetch('http://localhost:8000/students', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
usn: "CS24001",
name: "John Cena",
branch: "CSE",
semester: 7
})
})
.then(response => response.json())
.then(data => console.log(data));
POST
/students (Update)
Update an existing student (Supply "id" in JSON body).
JSON Fields
| Field | Type | Requirement | Description |
|---|---|---|---|
| id | integer | Required | The unique ID of the student to modify. |
| name | string | Required | Updated student name. |
| usn | string | Required | Updated USN Number. Must not conflict with others. |
| branch | string | Required | Updated branch. |
| semester | integer | Required | Updated semester. |
curl -X POST "http://localhost:8000/students" \
-H "Content-Type: application/json" \
-d '{"id": 1, "usn": "CS24001", "name": "John Cena", "branch": "CSE", "semester": 8}'
fetch('http://localhost:8000/students', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 1,
usn: "CS24001",
name: "John Cena",
branch: "CSE",
semester: 8
})
})
.then(response => response.json())
.then(data => console.log(data));
DELETE
/students?id={id}
Remove a student registry entry by ID.
Query Parameters
| Param | Type | Description |
|---|---|---|
| id | integer | Required. Unique ID of student to delete. |
curl -X DELETE "http://localhost:8000/students?id=1"
fetch('http://localhost:8000/students?id=1', {
method: 'DELETE'
})
.then(response => response.json())
.then(data => console.log(data));
Postman Test Guide
You can easily import these APIs directly into Postman to run tests manually:
- Create a New Collection in Postman (e.g. Student Registry API).
- Add GET, POST, and DELETE requests pointing to the endpoint URL.
- Set the request headers for POST with key
Content-Typeand valueapplication/json. - Set the raw request body option to
JSONformat for payloads.
Quick Info
Local Testing: Keep your local PHP dev server running. By default, the portal resolves URLs relative to where it is hosted.
CORS Enabled: Headers permit external connections so you can hit these exact endpoints from Postman, curl, or frontend clients safely.