Web API is a feature of the ASP.NET Framework for simplifying the process of building RESTful HTTP services. The tool’s portability allows it to be used in services that are intended to serve across platforms, device and browsers, and users can create endpoints that are accessible via descriptive URLs and HTTP verbs.
In this tutorial on DeveloperHandbook.com, the author shows followers how to create a RESTful Book Store API that authenticates and authorizes requests, exposes OAuth2 endpoints, and returns data about books and reviews.
The set up occurs in Visual Studio where we open the packages that should have been added to Web API already, with the Entity Framework for data persistence. Followers can add CORS support if they wish, then create the data structure to represent books and reviews. The API Controller is set up to use the Entity Framework’s Seed method to expose data, with a RESTful Endpoint that retrieves all of the book data.
The author then handles Authentication and authorization using OAuth and JSON Web Tokens (JWT), discussing the enabling of OAuth and formatting of JWT in detail before getting into testing. All code is provided so followers can build the same RESTful API, with instructions to copy the Sample Code exactly to avoid unpredictable behaviour.