Are you confused by REST APIs? Can't tell a PUT from a POST? No idea what a non-idempotent operation is? Despite their ubiquity, the details of what makes an API RESTful are often lost even on experienced developers. We'll cover the basics of the HTTP protocol that drives most REST services, break down the lingo, and clear up some misconceptions about this powerful and popular methodology.
10. -Roy Fielding, REST Discussion Mailing List
“[T]he goal of my dissertation is to teach people how
to think about the problem in terms of trade-offs, not
in terms of rigid repetition…”
11. Nothing is more easy than to reduce this mass to one
quarter of its bulk. You know that curious cellular
matter which constitutes the elementary tissues of
vegetable? This substance is found quite pure in many
bodies, especially in cotton, which is nothing more than
the down of the seeds of the cotton plant. Now cotton,
combined with cold nitric acid, become transformed into
a substance eminently insoluble, combustible, and
explosive. It was first discovered in 1832, by Braconnot, a
French chemist, who called it xyloidine. In 1838 another
Frenchman, Pelouze, investigated its different properties,
and finally, in 1846, Schonbein, professor of chemistry at
Bale, proposed its employment for purposes of war. This
powder, now called pyroxyle, or fulminating cotton, is
prepared with great facility by simply plunging cotton
for fifteen minutes in nitric acid, then washing it in
water, then drying it, and it is ready for use.
12. Nothing is more easy than to reduce this mass to one
quarter of its bulk. You know that curious cellular
matter which constitutes the elementary tissues of
vegetable? This substance is found quite pure in many
bodies, especially in cotton, which is nothing more than
the down of the seeds of the cotton plant. Now cotton,
combined with cold nitric acid, become transformed into
a substance eminently insoluble, combustible, and
explosive. It was first discovered in 1832, by Braconnot, a
French chemist, who called it xyloidine. In 1838 another
Frenchman, Pelouze, investigated its different properties,
and finally, in 1846, Schonbein, professor of chemistry at
Bale, proposed its employment for purposes of war. This
powder, now called pyroxyle, or fulminating cotton, is
prepared with great facility by simply plunging cotton
for fifteen minutes in nitric acid, then washing it in
water, then drying it, and it is ready for use.
16. Architectural Styles and the Design of
Network-based Software Architectures
Roy T. Fielding
(http://www.ics.uci.edu/~fielding/pubs/dissertation/faq.htm)
26. Resource
A thing, or a collection of things that…
May be concrete, or abstract…
May be static, or vary over time…
Has a name that is unique…
Uniform Interface
30. Representation
A sequence of bytes that…
Contains the state of a resource…
Consists of data…
Metadata about the data…
Metadata about the metadata…
Uniform Interface
40. Hypertext Application Language
A proposed (2012) standard that…
Expresses relationships between resources…
Supports JSON (JSON+HAL)…
Supports XML (XML+HAL)…
62. PUT
Request the server store a provided
representation of a resource at the
specified name, replacing the existing
resource if it exists.
UnsafeIdempotent
65. POST
Request the server store a provided
representation of a resource as a new
member of the collection identified by
the resource name
UnsafeNot Idempotent
79. Sanitize Assumptions
Patterns like REST make assumptions safer.
The further you are from the consumers of
your API, the closer you should adhere to
the pattern.
Advice