REST API — Interview Prep Guide
For Sayali Patil | Computer Engineering, SPPU | For resume claims, viva, and Fullstack
Intern interviews
How to use this guide: read through once, then use it as a quick revision sheet before interviews or viva.
Section 13 (Common Questions) and Section 15 (Add-on Q&A) are the fastest revision points the night
before.
1. What is a REST API?
• REST = Representational State Transfer
• An architectural style for communication between a client (frontend/mobile app) and a server
(backend) over HTTP.
• Data is usually exchanged in JSON format.
Frontend ---> REST API ---> Database
2. HTTP Methods
Method Purpose Example
GET Retrieve data Get all students
POST Create new data Add a student
PUT Update complete data Update student details
PATCH Update partial data Update only email
DELETE Delete data Delete a student
GET /students
POST /students
PUT /students/5
DELETE /students/5
3. HTTP Status Codes
Code Meaning
200 OK Request successful
201 Created Resource created
204 No Content Deleted successfully
400 Bad Request Invalid input
401 Unauthorized Authentication required
403 Forbidden No permission
404 Not Found Resource doesn't exist
500 Internal Server Error Server issue
4. JSON
REST APIs mostly send and receive JSON.
{
"id": 1,
"name": "Sayali",
"branch": "Computer"
}
5. URL Parameters
Path Parameter
GET /students/5
Student ID = 5
Query Parameter
GET /students?page=2
GET /students?branch=Computer
6. Request and Response
Example Request
POST /students
Body:
{
"name": "Sayali",
"age": 20
}
Response
{
"id": 10,
"name": "Sayali",
"age": 20
}
7. CRUD Operations
Operation HTTP Method
Create POST
Read GET
Update PUT / PATCH
Delete DELETE
Interviewers ask this frequently.
8. Headers
Common headers:
Content-Type: application/json
Authorization: Bearer token
9. Authentication (Basic Idea)
• JWT Token
• Bearer Token
• API Key
• OAuth (basic understanding)
Authorization: Bearer eyJhbGciOi...
10. REST Principles
• Client-Server Architecture — frontend and backend evolve independently
• Stateless — server doesn't remember previous requests
• Cacheable — responses can be cached to improve performance
• Uniform Interface — consistent resource naming and behavior
• Layered System — client cannot tell if it's connected directly to the server or an intermediary
11. API Testing Tools
• Postman ■ (most important)
• Insomnia (optional)
• Thunder Client (VS Code extension)
Using Postman, you should be able to:
• Send GET requests
• Send POST requests
• Add headers
• Send JSON body
• Check responses
• Test status codes
12. If Using Java (Spring Boot)
Know these basic annotations:
@RestController
@GetMapping
@PostMapping
@PutMapping
@DeleteMapping
@RequestBody
@PathVariable
@RequestParam
13. Common Interview Questions
• What is REST API?
• Difference between REST and SOAP?
• Difference between PUT and PATCH?
• Difference between PUT and POST?
• Difference between GET and POST?
• What is JSON?
• What is statelessness?
• What are HTTP methods?
• What are status codes?
• What is CRUD?
• What is an endpoint?
• What is an API?
• How do you test REST APIs?
• What is authentication?
• What is a JWT token?
14. Build at Least One Project
If REST API is on your resume, it's best to have a project demonstrating it:
• Student Management System API
• Employee Management API
• Library Management API
• Todo REST API
• E-commerce Product API
Can you add REST API to your resume now? Yes — if you've built or consumed REST APIs in a project
and can explain the topics above. Not yet — if you've only heard of REST APIs but haven't used them; build
a simple CRUD REST API first, then list it.
15. Add-On: Extra Interview Depth
Idempotency (frequently asked)
Method Idempotent? Why
GET Yes Same request, same result, no side effects
PUT Yes Calling it 5x = same final state as once
DELETE Yes Deleting an already-deleted resource still ends in 'gone'
POST No Each call typically creates a new resource
PATCH Usually not Depends on implementation
"Difference between" — Ready Answers
• REST vs SOAP: REST is an architectural style using HTTP + JSON (lightweight, stateless). SOAP is
a strict protocol using XML with built-in standards for security/transactions (heavier, more rigid).
• PUT vs POST: PUT is idempotent and updates/replaces a known resource (/students/5). POST
creates a new resource and is not idempotent (/students).
• PUT vs PATCH: PUT replaces the entire resource. PATCH updates only the specified fields.
Standard Error Response Format
{
"error": "NOT_FOUND",
"message": "Student with id 5 not found",
"status": 404
}
API Versioning
Needed because APIs evolve and old clients shouldn't break.
/api/v1/students
Pagination, Filtering, Sorting
GET /students?page=2&limit=10&sort=name&order=asc
CORS (Cross-Origin Resource Sharing)
Browsers block frontend-backend calls across different origins by default. Servers fix this by sending headers
like Access-Control-Allow-Origin.
Rate Limiting
Prevents API abuse by capping the number of requests a user/IP can make in a time window.
HATEOAS (advanced — know the term)
REST responses can include links to related actions (e.g., a student response includes a link to
/students/5/enroll). You don't need to implement it — just recognize the term if asked.
16. Rapid-Fire Q&A (Night-Before Revision)
Q: What is REST API?
A: An architectural style for client-server communication over HTTP, using standard methods (GET, POST,
PUT, DELETE) and typically exchanging data in JSON.
Q: What is statelessness?
A: Each request from client to server must contain all information needed to understand it — the server does
not store client context between requests.
Q: What is an endpoint?
A: A specific URL where an API can be accessed, e.g. /students/5.
Q: What is an API?
A: A set of rules that lets one software system communicate with another.
Q: What is a JWT token?
A: JSON Web Token — a compact, signed token used to securely transmit identity/claims between client and
server, commonly used for authentication.
Q: How do you test REST APIs?
A: Using tools like Postman — sending requests, adding headers/body, and verifying status codes and
response data.
Q: Is POST idempotent?
A: No. Calling POST multiple times typically creates multiple new resources, unlike GET, PUT, or DELETE.
Next step: learn Spring Boot + REST API + MySQL + Postman, then build one CRUD project (e.g. Student
Management System API) to demonstrate this on your resume with real experience to discuss.