Rest API - HTTP Status CodesIn a REST API, a client sends a request with a field 'age' set to -5. The server responds with status 422. What is the likely cause?AThe 'age' field is missing from the requestBThe 'age' value is semantically invalid despite correct syntaxCThe server does not support the 'age' fieldDThe client is unauthorized to send 'age'Check Answer
Step-by-Step SolutionSolution:Step 1: Understand semantic validationNegative age is invalid logically, so the server rejects it with 422 indicating semantic error.Step 2: Eliminate other optionsField is present, so not missing; server supports field; authorization unrelated to 422.Final Answer:The 'age' value is semantically invalid despite correct syntax -> Option BQuick Check:Invalid field value triggers 422 semantic error [OK]Quick Trick: 422 means data invalid, not missing or unauthorized [OK]Common Mistakes:Thinking 422 means missing fieldConfusing 422 with 403 ForbiddenAssuming server error instead of validation error
Master "HTTP Status Codes" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - PATCH for partial updates - Quiz 5medium HTTP Methods - POST for creating resources - Quiz 2easy REST API Fundamentals - REST vs SOAP vs GraphQL comparison - Quiz 3easy REST API Fundamentals - REST constraints and principles - Quiz 9hard REST API Fundamentals - REST vs SOAP vs GraphQL comparison - Quiz 4medium Request and Response Format - JSON as standard format - Quiz 6medium Request and Response Format - Response envelope patterns - Quiz 9hard URL and Resource Design - Nested resources - Quiz 2easy URL and Resource Design - Plural vs singular resource names - Quiz 8hard URL and Resource Design - Nested resources - Quiz 3easy