n00b1
V2EX  ›  问与答

请求RESTful的解释

  •  
  •   n00b1 · Jan 11, 2013 · 3502 views
    This topic created in 4910 days ago, the information mentioned may be changed or developed.
    For an API or web service to be RESTful, it must do the following:

    1, Separate the client from the server
    2, Not hold state between requests (meaning that all the information necessary to respond to a request is available in each individual request; no data, or state, is held by the server from request to request)
    3, Use HTTP and HTTP methods (as explained in the next section).

    如上这段是我摘抄的第2、3点我大致能够理解(也麻烦各位帮忙看看理解是否正确)
    2, 一旦有从client到server的request,server都会无条件的返回相应的response,譬如,我按照twitter给出的API去拿twits,twitter立马就会给予回应,返回相应的twits不能不给
    3, 就是用那些HTTP (GET, POST, PUT, DELETE)方法

    唯独第一点有点不明白,客户和服务器分离?客户服务器本来就是分离的呀,难道有不分离的情况?
    2 replies    1970-01-01 08:00:00 +08:00
    binux
        1
    binux  
       Jan 11, 2013   ❤️ 1
    “一旦有从client到server的request,server都会无条件的返回相应的response,譬如,我按照twitter给出的API去拿twits,twitter立马就会给予回应,返回相应的twits不能不给”

    可以不给,但是必须告诉你,我不给你
    ninion
        2
    ninion  
       Jan 11, 2013
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3646 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 05:02 · PVG 13:02 · LAX 22:02 · JFK 01:02
    ♥ Do have faith in what you're doing.