7. REST
API
REST
is
not
a
standard,
but
an
architecture
@lobster1234
8. REST
API
REST
is
not
a
standard,
but
an
architecture,
which
uses
HTTP
as
a
model
for
all
interac.ons.
If
HTTP
is
a
standard,
REST
is
a
conven&on.
@lobster1234
56. HTTP
200
OK
{
“success”
:
false
}
@lobster1234
57. HTTP
200
OK
{
“error”
:
”Person
jdoe
not
found”
}
@lobster1234
58. 2xx
for
success
3xx
for
redirects/caching
4xx
for
request/client
errors
5xx
for
server
errors
@lobster1234
59. Some
Useful
(and
not
so
common)
Codes
Return
aGer
a
delete
-‐
204
Failed
database
constraint
-‐
409
Method
not
supported
-‐
405
Trying
to
ask
for
too
much
data
-‐
413
Valida&on
Failure
-‐
418
@lobster1234
92. Requests
either
modify
the
state
of
a
resource,
or
read
it.
All
requests
to
the
cluster
see
the
same
state
of
the
resource
@lobster1234
93. Avoid
state
as
much
as
possible.
Maintain
the
state
in
the
database.
If
you
need
to
store
transient
state
on
the
server,
it’s
a
code
(or
architecture)
smell.
@lobster1234
94. Versioning
Using
301s
to
redirect/re&re
APIs
Caching
Using
HTTP
headers
correctly
Caching
response
bodies
@lobster1234