HTTP Headers
To negotiate the content type being sent
between the client and service, the request includes an Accept
header to indicate the acceptable media type. Optionally, it can also indicate the
MIME
Content-Type
being sent in the request.
The response from the server will return a
status code and the Content-Type
of the response.
The following are example HTTP content negotiation headers for JSON and XML:
- JSON
Accept: application/json; charset=utf-8 Content-Type: application/json; charset=utf-8
- XML
Accept: application/xml; charset=utf-8 Content-Type: application/xml; charset=utf-8