Create a Web API that supports CRUD (add-and-scan) operations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.