A REST (Representational State Transfer) Web service is a set of architectural principles by which you design Web services that focus on a system’s resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages.
Representational State Transfer – when called, a representation of the resource is returned, which places the client application in a state. Traversing the returned URL accesses another resource, placing the client application into yet another state. Thus, the client application changes (transfers) states with each resource representation.
http://example.com/customers/1234 http://example.com/orders/2007/10/776654 http://example.com/products/4554 http://example.com/orders/2007/11 http://example.com/products?color=green
<order self='http://example.com/customers/1234' > <amount>23</amount> <product ref='http://example.com/products/4554' /> <customer ref='http://example.com/customers/1234' /> </order>
http://example.com/customers/1234
<interface> Resource:
GET PUT POST DELETE |
/orders:GET – list all orders PUT – unused POST – add a new order DELETE – unused |
/orders/{id}:GET – get order details PUT – update order POST – add item DELETE – cancel order |
|
/customers:GET – list all customers PUT – unused POST – add a new customers DELETE – unused |
|
/customers/{id}:GET – get customer details PUT – update customer POST – unused DELETE – delete customer |
|
/customers/{id}/orders:GET – get all orders for customer PUT – unused POST – add order DELETE – cancel all customer orders |