What exactly is RESTful programming?

前端 未结 30 3223
Happy的楠姐
Happy的楠姐 2020-11-21 06:02

What exactly is RESTful programming?

30条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-21 06:23

    REST is using the various HTTP methods (mainly GET/PUT/DELETE) to manipulate data.

    Rather than using a specific URL to delete a method (say, /user/123/delete), you would send a DELETE request to the /user/[id] URL, to edit a user, to retrieve info on a user you send a GET request to /user/[id]

    For example, instead a set of URLs which might look like some of the following..

    GET /delete_user.x?id=123
    GET /user/delete
    GET /new_user.x
    GET /user/new
    GET /user?id=1
    GET /user/id/1
    

    You use the HTTP "verbs" and have..

    GET /user/2
    DELETE /user/2
    PUT /user
    

提交回复
热议问题