Even though this is simply a primer, a word about negotiation should be made before moving on. When an HTTP request is made, the term request implies that perhaps the request could be denied. That is, this is not a demand. This is an accurate portrayal. Within a closed system (i.e., one where the client and the server are always managed by the same organization), there is generally a high expectation that requests will be honored. But in situations where an organization has made their web APIs available to others (e.g., Google, PayPal, Facebook), requests might not always be honored. One reason is because the request specifies a response format that the server cannot provide. So, the request was processed but upon review of the required format type it notified the client that the format type was unsupported. The HTTP response, then, should send back a 406 (Not Acceptable) status code. This could then trigger the client to submit another request with one or more acceptable alternatives.

The take-away here is to encourage best practices in developing applications based on the HTTP protocol. The internet works best when the established status codes and header fields are used. Unfortunately, these are often ignored in favor of just using HTTP as a convenient utility for sending information back and forth between two systems.


Note: Introduced version 2.1, the GetBestContentNegotiation service can be used to determine the best content match that the server is able to return.

  • No labels