Building web services using the ASP.NET Core Web API
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 Representational State Transfer (REST) architectural style, that the HTTP standard would be great for building services because it defines the following:
- URIs to uniquely identify resources, like
https://localhost:5001/api/products/23
. - Methods to perform 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...