Difference between revisions of "Short Notes on RESTful APIs"

From PaskvilWiki
Jump to: navigation, search
(Created page with "'''WIP - check for updates later.''' Take this section with a pinch of salt. Also, see Disclaimer. == What is RESTful? == There is no standard for what REST...")
(No difference)

Revision as of 21:23, 28 June 2014

WIP - check for updates later.

Take this section with a pinch of salt. Also, see Disclaimer.

What is RESTful?

There is no standard for what RESTful API is, but there is a precedent on most of the functional specs. This list presents my preferences regarding the "gray" areas of the spec.

TODO - general definition

Interface Layout

Interface Recommendations

General

  • Use POST for both entity creation and update.
    Typically, RESTful API's are expected to use POST for element creation, and PUT for element update. I'm not a big supporter of this, as analogous to majority of programming (scripting) languages where you use the same assignment operator for both variable creation and updating, you should use the same HTTP method.
    Also, you'll avoid discussions about what is entity creation and update, esp. in scenarios where you want to allow creation and updates of sub-entities, where either of those can be viewed as update of the entity itself.
    Also, note that often RESTful is not supposed to allow access to sub-entities, but it makes life so much easier, and costs you less traffic.

Specific

Disclaimer

This list is by no means supposed to represent any "standard view" of RESTful API's.

It does not represent opinions of any of the companies I work(ed) with.

It is my personal checklist when designing interfaces. Many points depend only on your taste.

Some of the opinions are even "not really RESTful" but make life easier for you as backend dev, or for your consumers.