But the API returns a 400 error when you send the request. What is the most likely mistake in the documentation?
medium
A. The endpoint URL is missing a trailing slash
B. The HTTP method should be GET, not POST
C. Parameters should be inside a "requestBody" section, not "parameters"
D. The response code 201 is incorrect for creation
Solution
Step 1: Understand POST request structure
POST requests usually send data in the request body, not as URL parameters.
Step 2: Check documentation structure
Parameters listed under "parameters" implies URL/query parameters; for POST data, it should be under "requestBody".
Final Answer:
Parameters should be inside a "requestBody" section, not "parameters" -> Option C
Quick Check:
POST data = requestBody, not parameters [OK]
Hint: POST data goes in requestBody, not parameters [OK]
Common Mistakes:
Confusing query parameters with request body
Changing HTTP method incorrectly
Ignoring correct response codes
5. You want to document an endpoint that updates a user's email. It uses PATCH method at /users/{id}. The request body must include email as a string. The response returns 200 with updated user data or 400 if email is invalid. Which is the best way to structure this documentation snippet?