URI = scheme "://" authority "/" path [ "?" query] ["#" fragment"]
URI = http://myserver.com/mypath?query=1#document
General rules for URI formating:
URI path design
Collections: Always plural noun
GET /cats -> All cats in the collection
GET /cats/1 -> Single document for a cat 1
Documents: Points to a single object.
GET /cats/1 -> Single document for cat 1
GET /cats/1/kittens -> All kittens belonging to cat 1
GET /cats/1/kittens/1 -> Kitten 1 for cat 1
Controller: Used to map non standard CRUD
POST /cats/1/feed -> Feed cat 1
POST /cats/1/feed?food=fish ->Feed cat 1 a fish
Store: A source repository.
PUT /cats/2
Content type: Should be able to support multiple formats: JSON, YAML, XML, or any new future format.
Content Type Header: Use this header to communicate what content type you are sending.
Versioning:
api.domain.com/v2/resource.
Content-‐type: application/json+v1
Cache: Communicate that the call is cacheable and able to renew it expires.
Cache-‐Contro:lpublic, max-‐age=3600
Above setting may appear as:
Cache-Control: public
Expires: Mon, 09 February 2015 17:00:00 GMT
Cache-‐Control:no-‐cache, no-‐store
scheme://user:password@host:port/path?key1=value1&key2=value2#table_of_contents
Where key,value pairs = query
# = fragment = subsection of the resource