Building web services using ASP.NET Core
Before we build a modern web service, we need to cover some background to set the context for this chapter.
Understanding web service acronyms
Although HTTP was originally designed to request and respond with HTML and other resources for humans to look at, it is also good for building services.
Roy Fielding stated in his doctoral dissertation, describing the REST architectural style, that the HTTP standard would be good for building services because it defines the following:
- URIs to uniquely identify resources, like
https://localhost:5151/products/23
. - Methods for performing common tasks on those resources, like
GET
,POST
,PUT
, andDELETE
. - The ability to negotiate the media type of content exchanged in requests and responses, such as XML and JSON. Content negotiation happens when the client specifies a request header like
Accept: application/xml,*/*;q=0.8
. The default response format used by the ASP.NET Core...