This document provides an introduction and overview of Representational State Transfer (ReST). It discusses the history of ReST and how it was rediscovered by Roy Fielding. It also explains some key aspects of ReST including how it uses HTTP verbs like GET, POST, PUT, and DELETE on URLs to perform CRUD operations on resources. The document provides examples of ReST implementations on Twitter and Facebook. It also offers guidance on best practices for designing ReST APIs and includes some relevant quotes about ReST.
4. ReST - History
¡ñ Representational State Transfer
¡ñ ReST was re-DISCOVER-ed by Roy Fielding
¡ñ Doesnt require any external library
¡ñ Tightly bond with HTTP
10. ReST - Quotes
¡°Web it's not about HTML pages, it's about resources,
and those resources are located by URLs¡±
11. So ?
¡ñ We only need two base URLs as the location of a resource
(collection of resource, and single resource)
¡ñ Resources is Noun, use Noun :)
¡ñ Plural is better
Resource POST GET (READ) PUT DELETE
(CREATE) (UPDATE)
/users Create new List all Users Update All Delete All
user Users Users
/users/1 - Show User Update User Delete User
(with ID = 1) with ID = 1 (if with ID = 1
Exist)
12. Association ?
Easy :)
GET /departments/1/users
POST /departments/1/users
PUT /users/123
DELETE /users/123
13. Query
Use '?' for Query
GET /users?limit=50&offset=100
GET /users?username=indra&birth=1990
GET /users?column=id,name,username,birth
GET /users.json (/users.xml)