Content negotiation in WebAPI or other rest service.

The Accept header is used by HTTP clients to tell the server what content types they’ll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. However, as you may have noticed, HTTP requests can also contain Content-Type headers. Why? Well, think about POST or PUT requests….

Continue reading

Content negotiation in Web API(accept and content-type attribute of header)

Content negotiation is a way to serve client-specific representations of the same resource. A client might send this HTTP request: GET http://localhost.:21069/api/products/1 HTTP/1.1 Host: localhost.:21069 Accept: application/json, text/javascript, */*; q=0.01 In response, the server might send: HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: 57 Connection: Close The Accept header is used by HTTP clients to…

Continue reading