Rest API - Request and Response FormatWhich of the following is the correct JSON structure for a simple response envelope?A{"status": "success", "data": {"id": 1, "name": "Alice"}}B{"data": {"id": 1, "name": "Alice"}, "error": null}C{"result": {"id": 1, "name": "Alice"}}D{"message": "success", "payload": {"id": 1, "name": "Alice"}}Check Answer
Step-by-Step SolutionSolution:Step 1: Identify the typical keys in a response envelopeCommon keys include "status" for success/failure and "data" for the actual content.Step 2: Check each option for correct keys and structure{"status": "success", "data": {"id": 1, "name": "Alice"}} uses "status" and "data" correctly. Others use different or missing keys.Final Answer:{"status": "success", "data": {"id": 1, "name": "Alice"}} -> Option AQuick Check:Correct keys = status + data [OK]Quick Trick: Look for 'status' and 'data' keys in JSON [OK]Common Mistakes:Using 'result' or 'payload' instead of 'data'Missing the 'status' keyConfusing 'error' with 'status'
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 15hard HTTP Status Codes - Why status codes communicate outcomes - Quiz 15hard Query Parameters and Filtering - Why flexible querying empowers clients - Quiz 15hard REST API Fundamentals - REST constraints and principles - Quiz 14medium REST API Fundamentals - REST vs SOAP vs GraphQL comparison - Quiz 8hard Request and Response Format - Request body structure - Quiz 1easy Request and Response Format - Response headers (Cache-Control, ETag) - Quiz 6medium Request and Response Format - JSON as standard format - Quiz 13medium Request and Response Format - Content negotiation - Quiz 14medium Request and Response Format - Why consistent formats improve usability - Quiz 8hard