One: the preparatory work
You can directly download the source view
Download the completed project.
Download the full project
Crud refers to "create (C), read (R), update (U), and delete (D)", which are four basic database operations. Many HTTP services also emulate CRUD operations through rest or class rest APIs.
In this tutorial, we will build a very simple Web API to manage a list of products.
Each product contains a name, price, and category (for example, "Toys", "Hardware (Hardware)"), and a product ID.
Action Action |
HTTP method http method |
Relative URI Relative URI |
Get a list of all products Get a full list of products |
GET |
/api/products |
Get a product by ID Get a product by ID |
GET |
/api/products/id |
Get a product by category Get Products by Category |
GET |
/api/products?category=category |
Create a new product Create a new product |
POST |
/api/products |
Update a product Update a product |
PUT |
/api/products/id |
Delete a product Delete a product |
DELETE |
/api/products/id |
Create a Web API that supports CRUD (add-and-scan) operations