This is a simple Spring Boot REST API deployed on Render that allows you to add items and fetch items by ID. The application uses in-memory storage, so data resets when the server restarts.
🌐 Base URL
https://api-3q2w.onrender.com
All endpoints are prefixed with:
/api/item
POST /api/item/add
https://api-3q2w.onrender.com/api/item/add
Content-Type: application/json
{
"id": 1,
"name": "Laptop",
"description": "Gaming Laptop",
"cost": 75000
}200 OK
Item Added Successfully!
400 Bad Request
Item ID already exists or required fields are missing!
GET /api/item/{id}
https://api-3q2w.onrender.com/api/item/1
{
"id": 1,
"name": "Laptop",
"description": "Gaming Laptop",
"cost": 75000.0
}404 Not Found
- Open Postman
- Select HTTP method (
POSTorGET) - Paste the API URL
- For POST requests, set body to raw → JSON
- Click Send
Add Item
curl -X POST https://api-3q2w.onrender.com/api/item/add \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"name": "Laptop",
"description": "Gaming Laptop",
"cost": 75000
}'Get Item
curl https://api-3q2w.onrender.com/api/item/1-
The API uses in-memory storage (
ArrayList) -
Data is NOT persistent
-
On Render free tier:
- The app sleeps when idle
- App restarts clear all stored items
This behavior is expected and not a bug.
- Controller Layer: Handles HTTP requests
- Service Layer: Contains business logic
- Model Layer: Represents item data
- Storage: In-memory (no database)
- No database integration
- No update or delete APIs
- No global exception handling
- No input validation annotations
- Add database support (H2 / MySQL)
- Add Swagger UI for browser testing
- Add PUT & DELETE endpoints
- Add validation using
@Valid - Add global exception handling
This project is intended for:
- Learning Spring Boot REST basics
- Understanding controller-service design
- Demonstrating API deployment on Render
- Portfolio and interview demonstration