The plain-text body thing tripped me up more than I want to admit.
Start by clarifying the requirements and constraints, then outline a design that separates routing, parsing, and business logic. Emphasize robust error handling and proper HTTP semantics, and discuss trade-offs of using text/plain versus JSON.
Pro tip: Mention that you would document the API contract clearly and consider adding a custom media type or versioning to avoid future breaking changes. Also, highlight the importance of input validation and security even with plain text.
Ask about the expected format of the text/plain body, authentication, and any specific status codes or error messages required.
Define RESTful routes for CRUD operations (e.g., POST /resources, GET /resources/{id}, PUT /resources/{id}, DELETE /resources/{id}) and specify the expected text/plain body structure.
Describe how to read the raw request body and parse it manually (e.g., using a delimiter or key-value pairs), handling malformed input gracefully.
Return appropriate HTTP status codes (200, 201, 400, 404, 500) and a JSON response with a message field, ensuring consistency across endpoints.
Talk about why text/plain might be used, potential issues (e.g., lack of structure, parsing complexity), and how to mitigate them (e.g., schema validation, custom media types).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.