Ever wondered why your API sometimes screams at you with random 3-digit numbers? Let me simplify this for you. HTTP Status Codes — the language your server speaks when it cannot talk to you directly. Every backend dev who skips learning these properly ends up googling them at 2 AM during production incidents. Do not be that person. Here is what those numbers actually mean: → 2xx — Everything went well Server received your request. Processed it. Sent back the goods. → 200 OK — classic success → 201 Created — you built something new on the server → 202 Accepted — request is in, but processing is still happening Know which one to return in your REST APIs. They are NOT interchangeable. → 3xx — You are being redirected The resource moved. Server is politely pointing you elsewhere. → 301 = gone forever, update your bookmarks → 302 = temporarily elsewhere, come back later → 304 = nothing changed, use your cached version This is where SEO and API versioning decisions live. → 4xx — You made a mistake Stop blaming the server. The problem is on the client side. → 400 = your request is malformed → 401 = prove who you are first → 403 = I know who you are, but you cannot enter → 404 = this thing does not exist → 405 = wrong HTTP method, read the docs → 408 = you took too long, connection dropped Most debugging time in backend dev lives right here. → 5xx — The server made a mistake Now it is not your code. It is the infrastructure sweating. → 500 = something broke on the server, no specifics → 501 = this feature is not built yet → 502 = bad response from an upstream server → 503 = server is overwhelmed or down → 504 = upstream server took too long to respond This is the category that triggers incident alerts and ruins weekends. 18 status codes. One cheat sheet. Zero excuses for not knowing these. Whether you are building REST APIs, debugging microservices, or just cracking Java backend interviews - these codes come up everywhere. Screenshot this. Pin it somewhere visible. You will need it sooner than you think #HTTPStatusCodes #BackendDevelopment #Java #SpringBoot #SystemDesign #SoftwareEngineering #DSA #WebDevelopment #JavaDeveloper #CodingTips
HTTP Status Codes Simplified for Backend Devs
More Relevant Posts
-
Ever wondered why your API sometimes screams at you with random 3-digit numbers? Let me simplify this for you. HTTP Status Codes — the language your server speaks when it cannot talk to you directly. Every backend dev who skips learning these properly ends up googling them at 2 AM during production incidents. Do not be that person. Here is what those numbers actually mean: → 2xx — Everything went well Server received your request. Processed it. Sent back the goods. → 200 OK — classic success → 201 Created — you built something new on the server → 202 Accepted — request is in, but processing is still happening Know which one to return in your REST APIs. They are NOT interchangeable. → 3xx — You are being redirected The resource moved. Server is politely pointing you elsewhere. → 301 = gone forever, update your bookmarks → 302 = temporarily elsewhere, come back later → 304 = nothing changed, use your cached version This is where SEO and API versioning decisions live. → 4xx — You made a mistake Stop blaming the server. The problem is on the client side. → 400 = your request is malformed → 401 = prove who you are first → 403 = I know who you are, but you cannot enter → 404 = this thing does not exist → 405 = wrong HTTP method, read the docs → 408 = you took too long, connection dropped Most debugging time in backend dev lives right here. → 5xx — The server made a mistake Now it is not your code. It is the infrastructure sweating. → 500 = something broke on the server, no specifics → 501 = this feature is not built yet → 502 = bad response from an upstream server → 503 = server is overwhelmed or down → 504 = upstream server took too long to respond This is the category that triggers incident alerts and ruins weekends. 18 status codes. One cheat sheet. Zero excuses for not knowing these. Whether you are building REST APIs, debugging microservices, or just cracking Java backend interviews - these codes come up everywhere. Screenshot this. Pin it somewhere visible. You will need it sooner than you think. Comment HTTP and I'll DM you the full HTTP Status Codes PDF → completely free. Follow Narendra K. for more Java | Backend Development | DSA content delivered straight to your feed. #HTTPStatusCodes #BackendDevelopment #Java #SpringBoot #SystemDesign #SoftwareEngineering #DSA #WebDevelopment #JavaDeveloper #CodingTips
To view or add a comment, sign in
-
-
Building a Spring Boot REST API is easy. Building one that's maintainable, predictable, and production-ready, that takes deliberate practice. After working on APIs across fintech and enterprise systems, here are the practices I always come back to: Use HTTP semantics correctly GET for reads, POST for creation, PUT/PATCH for updates, DELETE for removal. Return the right status codes, 201 on creation, 204 on delete, 404 when a resource doesn't exist. Don't return 200 for everything. Centralize exception handling with @ControllerAdvice Never let raw stack traces leak to the client. Use @RestControllerAdvice with @ExceptionHandler to return consistent, structured error responses ,with a timestamp, status, message, and path every time. Validate input at the boundary Use @Valid + Bean Validation annotations (@NotNull, @Size, @Pattern) on your DTOs. Never trust what comes in over the wire. Fail fast at the controller layer, don't let bad data leak into your service or persistence layer. Version your API from day one /api/v1/orders is not premature, it's professional. URI versioning is the most explicit and easiest to route. Adding it after consumers are already integrated is painful. Don't learn that lesson the hard way. Paginate every collection endpoint Returning unbounded lists is a production incident waiting to happen. Spring Data's Pageable makes it trivial, use it by default, not as an afterthought when the table hits a million rows. Document with Springdoc OpenAPI Your API contract is part of your product. Auto-generate Swagger UI with Springdoc, annotate meaningfully so consumers don't have to guess what fields are required or what errors to expect. None of these are exotic. But skipping even one of them consistently leads to APIs that are brittle, hard to consume, and expensive to evolve. The best REST APIs feel obvious to the developer consuming them. That doesn't happen by accident, it's the result of small, deliberate decisions made at every layer. #Java #SpringBoot #RestAPI #BackendDevelopment #SoftwareEngineering #FullStackDevelopment #APIDesign #WebDevelopment #TechLeadership
To view or add a comment, sign in
-
-
Most REST APIs aren't actually REST. They're just HTTP with JSON. After years of building Java-based REST services, I've seen this pattern more times than I can count — endpoints that call themselves "RESTful" but don't go beyond basic HTTP calls. That's where the Richardson Maturity Model (RMM) becomes a real eye-opener. Leonard Richardson broke REST maturity into 4 levels: 🔹 Level 0 — The Swamp of POX One endpoint, one HTTP method (usually POST), everything tunneled through it. Think old-school SOAP services. No real REST here. 🔹 Level 1 — Resources You start modeling your domain as resources (/orders, /users). But you're still not leveraging HTTP properly. 🔹 Level 2 — HTTP Verbs Now you're using GET, POST, PUT, DELETE meaningfully. Status codes like 201, 404, 409 are used correctly. This is where most production Java APIs live — and where many teams stop. 🔹 Level 3 — HATEOAS Hypermedia as the Engine of Application State. Responses include links that tell the client what it can do next. The API becomes self-discoverable. In Spring, this is achievable with Spring HATEOAS out of the box. The honest truth from the field: Most enterprise systems sit comfortably at Level 2 — and that's often good enough. But understanding Level 3 makes you design better APIs even if you don't fully implement HATEOAS. It forces you to think: "What can the client do after this response?" That mindset shift alone has improved how I design resource relationships, pagination links, and error responses in every Java project I've worked on. Where does your API sit on the RMM? Drop a level below 👇 #Java #RestAPI #SpringBoot #SoftwareEngineering #APIDesign #BackendDevelopment #HATEOAS #WebServices #JavaDeveloper #CleanCode
To view or add a comment, sign in
-
🧩 Killing the "God Function": My First Big Refactor in Go 🛠️ Exams kept me away from the keyboard yesterday, but we are back! 📚🚀 Up until now, my signupHandler was doing everything. It was a massive "God Function" that read the HTTP request, decoded the JSON, validated the email and password, hashed the password, and talked to the database. It worked, but it was messy. Today, I started breaking it down, and my mentor guided me through a serious paradigm shift in how Go handles logic. Here are the 3 big lessons I learned while refactoring my validation logic into its own function: 1️⃣ Separation of Concerns ⚖️ I had to ask myself: What belongs in an HTTP handler, and what doesn't? JSON decoding stays in the handler because it's an HTTP concern. But checking if an email is valid? That is pure business logic. So, I ripped the validation out into its own function. 2️⃣ Idiomatic Naming & Signatures ✍🏾 In JavaScript, I might have written const signup_validation = (user) => {}. In Go, we use action verbs and camelCase. And because I only need to read the user data (not modify it), I pass it by value, not by pointer. The result: func validateSignup(u User) error 3️⃣ "True" is Redundant (The nil epiphany) 🤯 This was the hardest part for my brain to process. I wanted my function to return true or an error. But in Go, you don't need a boolean for success. You just return an error. If something fails, you return the error (e.g., errors.New("email required")). If it succeeds? You just return nil. In Go, nil is success. // The extracted, pure Go validation function func validateSignup(u User) error { if u.Email == "" { return errors.New("email is required") // No HTTP context here! } // ... password checks ... return nil // Success! } My API is finally starting to look like mature software, not just a beginner's script. We move! 💪🏾 To my fellow backend engineers: Do you extract your validation logic into completely separate packages, or keep them close to your HTTP handlers? Let’s gist in the comments 👇🏾 #Golang #BackendEngineering #SoftwareArchitecture #Refactoring #TechBro #TechInNigeria #WeMove
To view or add a comment, sign in
-
-
Day 24. My API was fast. Until it wasn't. I had this: return ResponseEntity.ok(userRepository.findAll()); 10 users in development. Works instantly. Feels perfect. Then production happened: → 50,000 users in the database → One API call loads everything → Response time: 40ms → 8 seconds → Memory spikes → API crashes That's not a performance issue. That's a design mistake. And it was there from day one. I just couldn't see it yet. That's when it clicked: Your API should never decide how much data to return. The client should. So I added pagination. (see implementation below 👇) What changed: → Performance — stable response time → Scalability — works at 100 or 100,000 rows → Stability — no memory spikes The hard truth: → findAll() works in tutorials → It breaks in production → Pagination is not an optimization — it's a requirement Fetching data is easy. Controlling how much you fetch is what makes your API scalable. Are you still using findAll() in production? 👇 Drop it below #SpringBoot #Java #BackendDevelopment #Performance #JavaDeveloper
To view or add a comment, sign in
-
-
If your API waits for everything to finish… you are slowing down your users. Some operations take time: • Sending emails • Generating reports • Calling external APIs • Processing files But many developers do this synchronously. ⸻ ❌ Blocking API @PostMapping("/register") public String registerUser() { userService.saveUser(); emailService.sendWelcomeEmail(); return "User Created"; } User waits until email is sent. Slow response. ⸻ ✅ Async Processing Return response immediately: @PostMapping("/register") public String registerUser() { userService.saveUser(); emailService.sendWelcomeEmailAsync(); return "User Created"; } ⸻ ⚙️ Spring Boot Example Enable async: @EnableAsync @SpringBootApplication Async method: @Async public void sendWelcomeEmailAsync() { // send email } ⸻ 🧠 What Happens Now User Request ↓ Save User ↓ Return Response ↓ Async Email Processing Faster APIs. ⸻ ⚠️ When to Use Async Use for: • Emails • Notifications • Background jobs • Logging Avoid for: • Transactions • Payment processing • Critical operations ⸻ 💡 Lesson Fast APIs don’t do everything. They delegate work to background processing. ⸻ Day 20 of becoming production-ready with Spring Boot. Question: Do you use async processing in your APIs? #Java #SpringBoot #BackendEngineering #Performance #Async
To view or add a comment, sign in
-
-
What is an API? What is REST? What is RESTful API? Have a go at a beginners overview I wrote.
To view or add a comment, sign in
-
🚨 Stop guessing API errors. Read them like a pro. Ever spent 30 minutes debugging… just to realize it was a 400 Bad Request? 😅 👉 Understanding HTTP status codes is not optional. It’s a superpower for every backend & full stack developer. ⚡ API Status Codes — what they REALLY mean: 🟢 2xx = You’re good ✔️ 200 → Everything worked ✔️ 201 → Resource created ✔️ 204 → Success, no content 🔵 3xx = Look somewhere else ➡️ 301 → Permanent redirect ➡️ 302 → Temporary redirect ➡️ 304 → Use cache 🟡 4xx = You messed up (client side) ⚠️ 400 → Bad request (invalid input) 🔐 401 → Not authenticated ⛔ 403 → Not allowed 🔍 404 → Not found ⚡ 409 → Conflict 🧪 422 → Validation failed 🚦 429 → Too many requests 🔴 5xx = Server is crying 💥 500 → Internal error 🌐 502 → Bad gateway 📉 503 → Service unavailable ⏳ 504 → Timeout 🧠 Debug faster with this mindset: ✔️ 2xx → Relax, it’s working ✔️ 3xx → Check URL / caching ✔️ 4xx → Fix your request ✔️ 5xx → Check logs + backend 🔥 Real talk: If you’re building APIs with Spring Boot, Node, or microservices, mastering this = faster debugging + better systems + less stress 💬 Be honest… Which status code wastes most of your time? 😅 #API #Backend #Java #FullStack #WebDevelopment #Debugging #SoftwareEngineering #Microservices #DevTips
To view or add a comment, sign in
-
-
𝘋𝘢𝘺 4/300 — 𝘉𝘶𝘪𝘭𝘥𝘪𝘯𝘨 𝘔𝘺 𝘚𝘢𝘢𝘚 𝘗𝘳𝘰𝘫𝘦𝘤𝘵 𝘪𝘯 𝘗𝘶𝘣𝘭𝘪𝘤 Today I moved one step closer to a real backend system. Not just writing code… but connecting everything together. 𝘞𝘩𝘢𝘵 𝘐 𝘸𝘰𝘳𝘬𝘦𝘥 𝘰𝘯 𝘵𝘰𝘥𝘢𝘺: Built the 𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐫 𝐋𝐚𝐲𝐞𝐫 (API Layer) This layer connects: • Client (Frontend / Postman) • Backend system • Service layer Now my backend can actually receive requests and send responses. 𝑾𝒉𝒚 𝒕𝒉𝒊𝒔 𝒎𝒂𝒕𝒕𝒆𝒓𝒔: Controller is the entry point of the system. • Handles HTTP requests (POST, GET) • Converts JSON → Java Object • Sends response back as JSON • Delegates logic to service layer Without controller → backend is isolated With controller → backend becomes usable 𝘞𝘩𝘢𝘵 𝘐 𝘣𝘶𝘪𝘭𝘵: • API: /auth/register-super-admin • Flow: Request → Controller → Service → DB → Response • Clean separation between layers 𝘞𝘩𝘢𝘵 𝘐 𝘭𝘦𝘢𝘳𝘯𝘦𝘥: • Role of 𝐑𝐞𝐬𝐭𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐫 • How 𝐑𝐞𝐪𝐮𝐞𝐬𝐭𝐌𝐚𝐩𝐩𝐢𝐧𝐠 & 𝐏𝐨𝐬𝐭𝐌𝐚𝐩𝐩𝐢𝐧𝐠 work • How 𝐑𝐞𝐪𝐮𝐞𝐬𝐭𝐁𝐨𝐝𝐲 converts JSON → Object • How Spring returns Object → JSON automatically • Why controller should stay thin (no business logic) 𝑩𝒊𝒈 𝒓𝒆𝒂𝒍𝒊𝒛𝒂𝒕𝒊𝒐𝒏: Controller is not for logic. It is for flow control. Clean backend = clear separation of responsibilities. Today I didn’t just write an API. I built: • Entry point of the system • Proper request-response flow • Clean architecture foundation 𝑾𝒉𝒂𝒕 𝑰 𝒏𝒐𝒕𝒊𝒄𝒆𝒅 (Improvement area): Right now I am directly using Entity in controller. Next step is to improve it using DTO + validation + better responses. 𝘞𝘩𝘢𝘵’𝘴 𝘯𝘦𝘹𝘵: Make this production-ready: • DTO layer • Input validation • Exception handling • ResponseEntity 𝑺𝒕𝒊𝒍𝒍 𝒍𝒆𝒂𝒓𝒏𝒊𝒏𝒈, 𝒔𝒕𝒊𝒍𝒍 𝒃𝒖𝒊𝒍𝒅𝒊𝒏𝒈, 𝒔𝒕𝒊𝒍𝒍 𝒊𝒎𝒑𝒓𝒐𝒗𝒊𝒏𝒈. #300DaysOfCode #BuildInPublic #BackendDevelopment #SpringBoot #JavaDeveloper #SystemDesign #LearningJourney #Consistency #SoftwareEngineering #APIDesign #SaaS #FullStackDeveloper #DatabaseDesign
To view or add a comment, sign in
-
-
🌐 REST API Design — Small Decisions, Big Impact Writing APIs that work is easy. Designing APIs well is engineering. Here are some REST API practices I focus on 👇 ✅ 1. Use Proper HTTP Methods GET → Fetch data POST → Create PUT/PATCH → Update DELETE → Remove ✅ 2. Use Resource-Based URLs Good: /api/users/101/orders Avoid: /getUserOrdersById ✅ 3. Return Proper Status Codes 200 → Success 201 → Created 400 → Bad Request 401 → Unauthorized 404 → Not Found 500 → Server Error ✅ 4. Use DTOs + Validation Validate requests early: @Valid @NotBlank @Email Clean input = safer APIs. ✅ 5. Keep Responses Consistent { "success": true, "message": "Order created", "data": {...} } Consistency improves frontend integration. 🚀 In my projects I also use: ✔ Pagination ✔ Versioning (/api/v1) ✔ Exception handling ✔ Meaningful endpoint naming 🧠 Key Insight: Good APIs reduce bugs before they happen. What API practice do you consider non-negotiable? #Java #SpringBoot #RESTAPI #BackendDevelopment #SoftwareEngineering #FullStackDeveloper
To view or add a comment, sign in
-
Explore related topics
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