REST APIs and JSON
An integration developer is fixing a request to the team's internal report service. Its published contract requires max_items to be a JSON number representing a positive whole number and preview to be a JSON boolean. It performs no string-to-number or string-to-boolean coercion. For this service, status 422 means the body parsed as JSON but failed the field-type contract; it does not indicate a transport failure.
The caller wants a limit of four items and preview mode disabled. The captured exchange is:
POST /v1/reports HTTP/1.1
Host: reports.example
Content-Type: application/json
{"max_items":"4","preview":"false"}
HTTP/1.1 422 Unprocessable Content
Content-Type: application/json
{"error":{"code":"field_type_mismatch","fields":["max_items","preview"]}}
The method, path, and headers already match the service contract. Which replacement body satisfies the field types and preserves the caller's requested values?
Choose one answer. Your answer is checked immediately.
