REST con Django

De WikiEducator
< Usuario:Lmorillas‎ | desarrollo web servidor‎ | django
Revisión a fecha de 10:49 19 dic 2013; Lmorillas (Discusión | contribuciones)

(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar


Qué es REST

REST (Representational State Transfer) son un conjunto de reglas que clientes y servidores tienen que seguir para comunicarse. Si un modo de comuncación sigue esas reglas se llama RESTful. El protocolo RESTful más famoso es HTTP. En un servicio RESTful una URL idenfica un trozo de información que con el que el usuario actúa. Cada trozo de información es un recurso. A los recursos se accede usando los verbos HTTP:

POST
Crea un recurso.
GET
Lee un recurso
PUT
Actualiza un recurso existente
DELETE
Elimina un recurso

Características

Client-Server
There should be a separation between the server that offers a service, and the client that consumes it.
Stateless
Each request from a client must contain all the information required by the server to carry out the request. In other words, the server cannot store information provided by the client in one request and use it in another request.
Cacheable
The server must indicate to the client if requests can be cached or not.
Layered System
Communication between a client and a server should be standardized in such a way that allows intermediaries to respond to requests instead of the end server, without the client having to do anything different.
Uniform Interface
The method of communication between a client and a server must be uniform.
Code on demand
Servers can provide executable code or scripts for clients to execute in their context. This constraint is the only one that is optional.


Lectura

Cómo le expliqué REST a mi esposa
http://blog.tordek.com.ar/2008/03/como-le-explique-rest-a-mi-esposa/
Codemotion
https://github.com/jespino/ponencias/tree/master/2013/codemotion/django-rest-framework
HTTP Status Codes
http://restpatterns.org/HTTP_Status_Codes
Servicios Rest
http://www.xml.com/pub/a/2004/12/01/restful-web.html
http://www.xfront.com/REST-Web-Services.html

Con Django