What exactly is RESTful programming?

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

What exactly is RESTful programming?

30条回答
  •  余生分开走
    2020-11-21 06:36

    This is amazingly long "discussion" and yet quite confusing to say the least.

    IMO:

    1) There is no such a thing as restful programing, without a big joint and lots of beer :)

    2) Representational State Transfer (REST) is an architectural style specified in the dissertation of Roy Fielding. It has a number of constraints. If your Service/Client respect those then it is RESTful. This is it.

    You can summarize(significantly) the constraints to :

    • stateless communication
    • respect HTTP specs (if HTTP is used)
    • clearly communicates the content formats transmitted
    • use hypermedia as the engine of application state

    There is another very good post which explains things nicely.

    A lot of answers copy/pasted valid information mixing it and adding some confusion. People talk here about levels, about RESTFul URIs(there is not such a thing!), apply HTTP methods GET,POST,PUT ... REST is not about that or not only about that.

    For example links - it is nice to have a beautifully looking API but at the end the client/server does not really care of the links you get/send it is the content that matters.

    In the end any RESTful client should be able to consume to any RESTful service as long as the content format is known.

提交回复
热议问题