Rest API - Request and Response FormatWhich of the following is a correct JSON structure for a simple error response in a REST API?A{"error": {"code": 404, "message": "Not Found"}}B{"status": 200, "message": "Success"}C{"data": {"id": 1, "name": "Item"}}D{"error_code": "404", "error_msg": "Not Found"}Check Answer
Step-by-Step SolutionSolution:Step 1: Identify standard error response keysCommon keys include "error", "code", and "message" to describe the problem.Step 2: Check each option{"error": {"code": 404, "message": "Not Found"}} uses "error" with "code" and "message" correctly in JSON format.Final Answer:{"error": {"code": 404, "message": "Not Found"}} -> Option AQuick Check:Standard error keys = code and message [OK]Quick Trick: Look for 'error', 'code', and 'message' keys in JSON [OK]Common Mistakes:MISTAKESConfusing success response with errorUsing wrong key names like error_codeMissing nested error object
Master "Request and Response Format" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - GET for reading resources - Quiz 11easy HTTP Methods - HEAD and OPTIONS methods - Quiz 6medium HTTP Status Codes - 200 OK and 201 Created - Quiz 15hard HTTP Status Codes - 500 Internal Server Error - Quiz 2easy Query Parameters and Filtering - Multiple filter parameters - Quiz 15hard Query Parameters and Filtering - Sort direction (asc, desc) - Quiz 14medium Query Parameters and Filtering - Multiple filter parameters - Quiz 7medium REST API Fundamentals - REST vs SOAP vs GraphQL comparison - Quiz 15hard Request and Response Format - Response headers (Cache-Control, ETag) - Quiz 10hard URL and Resource Design - Nested resources - Quiz 11easy