What exactly is RESTful programming?

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

What exactly is RESTful programming?

30条回答
  •  执念已碎
    2020-11-21 06:47

    This is what it might look like.

    Create a user with three properties:

    POST /user
    fname=John&lname=Doe&age=25
    

    The server responds:

    200 OK
    Location: /user/123
    

    In the future, you can then retrieve the user information:

    GET /user/123
    

    The server responds:

    200 OK
    JohnDoe25
    

    To modify the record (lname and age will remain unchanged):

    PATCH /user/123
    fname=Johnny
    

    To update the record (and consequently lname and age will be NULL):

    PUT /user/123
    fname=Johnny
    

提交回复
热议问题