Skip to main content
REST-APIS5 MIN READ

Content Negotiation Without Surprises

Recall the REST API headers and defaults that make content negotiation predictable.

Request body What does Content-Type declare? The media type of the representation sent in the request body. Use it before parsing. If unsupported, return 415 Unsupported Media Type. Response preference What does Accept declare? The response media types the client is willing to process. If none are possible, return 406 Not Acceptable or document a default. Common objection “Can we just auto-detect JSON or CSV from the first character?” Import endpoint with money-impacting rows. Your line Auto-detect only as a documented convenience after enforcing allowed media types; never treat an unknown body as success. Silent fallback creates false-positive imports. It…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us