✅𝗥𝗘𝗦𝗧 𝗔𝗣𝗜, at its core, is just this. You expose 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 HTTP tells 𝘄𝗵𝗮𝘁 𝗵𝗮𝗽𝗽𝗲𝗻𝘀 𝘁𝗼 𝘁𝗵𝗲𝗶𝗿 𝘀𝘁𝗮𝘁𝗲 That’s it. How HTTP verbs actually behave 𝗚𝗘𝗧 → read state 𝗣𝗢𝗦𝗧 → create new state 𝗣𝗨𝗧 → replace state 𝗗𝗘𝗟𝗘𝗧𝗘 → remove state Remember this mapping — most REST confusion disappears. Example: 𝗰𝗵𝗲𝗰𝗸𝗶𝗻𝗴 𝘂𝘀𝗲𝗿𝗻𝗮𝗺𝗲 𝗮𝘃𝗮𝗶𝗹𝗮𝗯𝗶𝗹𝗶𝘁𝘆 @RestController @RequestMapping("/users") public class UserController { @GetMapping("/{username}/available") public boolean isAvailable(@PathVariable String username) { return !username.equalsIgnoreCase("admin"); } } Here: 🔸/users → the resource 🔸{username} → the state being queried 🔸𝗚𝗘𝗧 → correct verb because nothing changes 📌 𝗞𝗲𝘆 Insight : When an endpoint feels confusing, don’t start with annotations. Ask one thing instead: “𝗔𝗺 𝗜 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝘀𝘁𝗮𝘁𝗲, 𝗼𝗿 𝗰𝗵𝗮𝗻𝗴𝗶𝗻𝗴 𝘀𝘁𝗮𝘁𝗲?” Clear state intent leads to correct REST design. Follow Bindu shree and my Mentor Suresh Bishnoi #Java #RESTAPI #APIDesign #API #JSON #Spring #SpringBoot #SoftwareArchitecture #Server #Data #BackendDevelopment #SoftwareEngineering #JavaDeveloper #CleanCode
REST API Simplified: HTTP Verbs and State
More Relevant Posts
-
Here is how I debug slow APIs before touching the code. Most developers jump straight into the code when an API is slow. I check these things first: —> Is it the database? Turn on query logging. Look for queries taking more than 100ms. Most slow APIs are slow queries in disguise. —> Is it N+1? One API call triggering 100 database calls. Add JOIN FETCH or batch your queries. Instant fix. —> Is it missing indexes? Run EXPLAIN on your slow query. If you see sequential scan on a large table, add an index. —> Is it external service calls? API calling another API calling another API. Add timeouts. Add circuit breakers. Add async where possible. —> Is it serialization? Returning 50 fields when frontend needs 5. Use DTOs or projections. Stop sending the entire entity. —> Is it connection pool exhaustion? Database connections maxed out. Threads waiting. Check your pool size and connection timeout settings. —> Is it missing caching? Same data fetched 1000 times per minute. Add Redis or in-memory cache for static lookups. 90% of slow APIs fall into one of these categories. Fix the right problem first. Then optimize the code. What is your go-to first step when debugging a slow API? #Java #SpringBoot #Performance #Backend #SoftwareDevelopment
To view or add a comment, sign in
-
Small Change — Big Performance Impact This week I fixed an N+1 performance issue caused by calling the database inside a loop. The problem: For each item in a list, the code triggered a separate DB query. Under load → too many round trips → slower response time. The fix: Moved the database call outside the loop and fetched all required data in a single query. Result: ✔ Fewer DB calls ✔ Faster API response ✔ Better scalability Sometimes performance improvements are not complex — just smarter query design. #Java #SpringBoot #Backend #Performance #CleanCode
To view or add a comment, sign in
-
-
THE "ROOKIE MISTAKE" 🎯 I spent 3 hours debugging a "database performance issue" today. 🐌 The problem? It wasn't the database at all. 🤦♂️ Here's what actually happened 👇 My API was making 1 query... then 50 more queries... then 200 more queries. 😱 Classic N+1 problem. Every. Single. Time. The fix took 5 minutes: ❌ for (User user : users) { user.getOrders(); } ✅ @EntityGraph or JOIN FETCH Performance improved by 40x. ⚡ The lesson? 💡 ✅Sometimes the "slow database" is just poorly designed queries. ✅Always check your query count before blaming infrastructure. What's your most embarrassing debugging moment that taught you the most? 👇Comment down👇 #Java #SpringBoot #DatabasePerformance #BackendDevelopment #LessonsLearned
To view or add a comment, sign in
-
I once noticed a random latency spikes in one of our backend services. Locally everything worked fine. In lower environments too. But in production, response times would suddenly jump from 200ms to 3–4 seconds. After digging deeper, the issue wasn’t Spring Boot or the server size. It was database behavior under real traffic. The root cause: • A frequently used API was triggering an unindexed query • Under load, it caused full table scans • Connection pool threads started waiting • Latency cascaded across dependent services The fix wasn’t scaling the service. It was: • Adding proper indexing • Refactoring the query • Monitoring slow query logs • Tuning connection pool configuration Response time stabilized immediately. Sometimes performance problems aren’t architecture issues. They’re visibility and fundamentals issues. #PerformanceTuning #ScalableSystems #SoftwareEngineering #Tech #Developer #SpringBoot #Microservices #Java
To view or add a comment, sign in
-
💥 One production issue changed how I design APIs forever. A few years ago, one of our critical APIs suddenly became extremely slow in production. Nothing made sense. ✅ Servers were healthy ✅ CPU & memory looked normal ✅ No application errors in logs But users were waiting… and waiting. For hours, we checked caching, network calls, thread pools — everything looked fine. Then we looked at the database logs. And that’s where the real problem appeared. A single API request was silently executing 𝐝𝐨𝐳𝐞𝐧𝐬 𝐨𝐟 𝐝𝐚𝐭𝐚𝐛𝐚𝐬𝐞 𝐪𝐮𝐞𝐫𝐢𝐞𝐬. The reason? 👉 Lazy loading combined with entity relationships. What looked like one simple query in code was actually triggering multiple hidden queries — the classic 𝐍+1 𝐩𝐫𝐨𝐛𝐥𝐞𝐦. It worked perfectly in local testing with small data. But with real production traffic, performance collapsed. --- What this incident taught me: ✅ Never trust performance results from local environments ✅ Always monitor database queries, not just application logs ✅ ORM abstractions can hide expensive operations ✅ Performance problems often start at design level 💡 Biggest lesson: Slow APIs are rarely a Java problem — they are usually a data access problem. Have you ever debugged an issue where the real cause was completely unexpected? 👇 #Java #SpringBoot #BackendDevelopment #Microservices #SoftwareEngineering #ProductionLessons
To view or add a comment, sign in
-
🔥 DAY 3 **How I optimized a slow API in production** We had an API taking 3.5 seconds. Here’s what I did: 1️⃣ Checked logs 2️⃣ Found repeated DB queries 3️⃣ Added proper indexing 4️⃣ Reduced unnecessary joins 5️⃣ Cached frequent data Result? 3.5s ➝ 400ms 🚀 Lesson: Most performance issues are database-related. #Performance #BackendEngineer #Java
To view or add a comment, sign in
-
Most systems don’t fail because of traffic. They fail because of poor design decisions. Example: Caching. When to use cache? High read, low write Data that can tolerate slight staleness When NOT to use cache? Real-time financial data Frequently changing records Simple decisions like this can reduce database load by 70–80%. System Design is less about tools, more about trade-offs. #SystemDesign #Java #Backend #Microservices
To view or add a comment, sign in
-
Released: Spring CRUD Generator v1.2.0 Spring CRUD Generator is a YAML/JSON-driven Maven plugin that bootstraps a Spring Boot CRUD backend (entities, DTOs, mappers, services, controllers), with optional OpenAPI/Swagger resources, Flyway migrations, and Docker resources. Key updates in v1.2.0: - Improved Flyway migration compatibility across MySQL / MSSQL / PostgreSQL - Reserved SQL keywords are now supported in generated Flyway scripts - Fixed compatibility with MySQL versions newer than 8.4 - Fixed unique constraint naming - Extended JSON type to support collections: JSON<List<T>> and JSON<Set<T>> - Docker Compose: healthchecks (start app when DB(s) are ready) and fixed port mapping - OpenAPI: `.openapi-generator-ignore` updated to avoid overwriting pom.xml and README files - Added a project banner (version + source/output path) Repo: https://lnkd.in/deyVCnze Release notes: https://lnkd.in/dUqFqwma Demo project: https://lnkd.in/dn2UikSk #java #springboot #flyway #openapi #docker #maven #opensource
To view or add a comment, sign in
-
One line of code that saved our production database. We had a query returning 50,000 rows when we only needed 10. The API was timing out. Users were frustrated. The fix: Before: List<User> users = userRepository.findAll(); After: Pageable pageable = PageRequest.of(0, 10); Page<User> users = userRepository.findAll(pageable); Same query. 10 rows instead of 50,000. Response time went from 8 seconds to 200ms. Pagination is not optional. It is survival. What simple fix saved your production system? #Java #SpringBoot #Database #Performance #BackendDevelopment
To view or add a comment, sign in
-
🚀 Day 31/100 - Spring Boot - ResponseEntity & HTTP Status Codes In real-world APIs, returning only data is not enough❗ You also need proper HTTP status codes, headers, and control over the response❗ That’s where ResponseEntity comes in 👇 ➡️ What is ResponseEntity? ResponseEntity represents the entire HTTP response: 🔹Response body 🔹HTTP status code 🔹Response headers It gives you full control over what the client receives. ➡️ Example: See attached image 👇 ➡️ Why use ResponseEntity? 🔹Provides precise control over HTTP status codes 🔹Better API communication with clients 🔹Industry-standard REST practices 🔹Essential for production-ready APIs Next post: https://lnkd.in/dxqEf4sE Previous post: https://lnkd.in/dR_V_zWv #100Days #SpringBoot #Java #RESTAPI #ResponseEntity #HTTPStatus #BackendDevelopment #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
Explore related topics
- Guidelines for RESTful API Design
- How to Understand REST and Graphql APIs
- Writing Clean Code for API Development
- How to Understand API Design Principles
- Creating User-Friendly API Endpoints
- Best Practices for Designing APIs
- Key Principles for Building Robust APIs
- Essential HTTP Methods for APIs
- Key Principles for API and LLM Testing
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Thank you for sharing it