1. Traditional request address review

GET http:/ / www.example.com/getUsers / / get the user list
GET http:/ / www.example.com/getUser?id=1 / / such as for a single user information
POST http:/ / www.example.com/modifyUser / / modify user information
GET http:/ / www.example.com/deleteUser?id=1// to delete user information
Copy the code

2. RESTful API Overview

A set of specifications for design requests.

  • GET: Obtains data
  • POST: Adds data
  • PUT: Updates data
  • DELETE: deletes data

users => /users

articles => /articles

3. RESTful APIS

The GET: HTTP://www.example.com/users get user list dataPOST: HTTP://www.example.com/users Create (add) user dataThe GET: HTTP:/ / www.example.com/users/1 for the user ID for 1 user informationPUT: HTTP:/ / www.example.com/users/1, modify the user ID to 1 user informationDELETE: HTTP:/ / www.example.com/users/1 to delete user ID to 1 user information
Copy the code