Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In ASP.NET Web API, if a client request does not include an Accept header, the API will by default return a response in JSON format. This is because JSON is the default format for Web API responses, and the API assumes that JSON is the preferred format for clients that do not specify their preference.

However, if the request includes an Accept header with multiple media types, the API will return a response in the specified format if it is supported by the API. If the specified format is not supported by the API, it will return a 406 (not acceptable) error response.

If the client specifies a single media type in the Accept header, the API will return a response in the specified format if it is supported by the API. If the specified format is not supported by the API, it will return a 415 (unsupported media type) error response.