This chapter introduces API controllers. An API controller is just an MVC controller that doesn't return a UI but instead works with requests and payloads and returns responses in machine-readable formats, such as JSON or XML. We will cover a number of aspects related to API controllers, from security to versioning.
The following topics will be covered in this chapter:
- Introduction to REST
- Model binding
- Authorizing access to resources
- Applying OpenAPI conventions
- Returning validation results
- Performing content negotiation
- Handling errors
- Understanding API versioning
- Generating API documentation
- Serving OData
By the end of this chapter, we will be able to work with authentication and validation overall, without much human interaction.