RESTful Web Services    in Drupal 7
RESTful Web Services in Drupal 7‣ Web Services introduction‣   Why REST?‣   The Bricks: Drupal 7, Entity API, RESTful Web ...
Web services                 SOAP,  Service      XML-RPC,                              Service Requester     REST, etc... ...
Web services with Drupal                      REST  Service                    Service Requester                   Provider
Why REST?‣   Use standard HTTP (simple client and simple API)‣   Multiple data formats (JSON, XML, etc...)‣   Performance ...
The bricks   Connector   REST   RESTws    Drupal 6        or            Entity API    Drupal 7    Service           Drupal...
Entity APIThis module extends the entity API of Drupalcore in order to provide a unified way todeal with entities and their...
RESTful Web ServicesExposes Drupal resources (e.g. entities) as RESTful web services.‣ Provides only RESTful services.‣ Bu...
RESTful Web Services: Test it!To obtain the JSON representation of an entity use yourbrowser to visit:http://yoursite.com/...
RESTful Web Services: CRUDSupports full CRUD (Create, Read, Update, Delete) for resources:‣   Create: HTTP PUT /<entity ty...
RESTful Web Services: Auth and Perms               can be achieved via separate modules, maybe making use of‣ Authenticati...
Connector: REST Client
Connector: Example (webform hook)
Connector: Example (response)
Case Study                 REST  Pamm Travel             Tikal    (Drupal 6)          (Drupal 7)    Service             Se...
Case Study                 REST    Intersos              Tikal    (Drupal 6)          (Drupal 7)    Service             Se...
Questions?                          http://bmeme.com   Luca Corbo (lucor)                          Daniele Piaggesi (g0bli...
Upcoming SlideShare
Loading in …5
×

RESTful Web Services in Drupal7

11,905 views

Published on

Published in: Technology
1 Comment
6 Likes
Statistics
Notes
  • Does slide 10 have a typo? Shouldn't Create be POST and Update be PUT?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
11,905
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
155
Comments
1
Likes
6
Embeds 0
No embeds

No notes for slide

RESTful Web Services in Drupal7

  1. 1. RESTful Web Services in Drupal 7
  2. 2. RESTful Web Services in Drupal 7‣ Web Services introduction‣ Why REST?‣ The Bricks: Drupal 7, Entity API, RESTful Web Services‣ Connector (REST client)‣ Let’s go coding...‣ Case Study‣ Questions?
  3. 3. Web services SOAP, Service XML-RPC, Service Requester REST, etc... Provider
  4. 4. Web services with Drupal REST Service Service Requester Provider
  5. 5. Why REST?‣ Use standard HTTP (simple client and simple API)‣ Multiple data formats (JSON, XML, etc...)‣ Performance and scalability (Cacheable)
  6. 6. The bricks Connector REST RESTws Drupal 6 or Entity API Drupal 7 Service Drupal 7 Requester Service Provider
  7. 7. Entity APIThis module extends the entity API of Drupalcore in order to provide a unified way todeal with entities and their properties.Additionally, it provides an entity CRUDcontroller, which helps simplifying thecreation of new entity types.http://drupal.org/project/entity
  8. 8. RESTful Web ServicesExposes Drupal resources (e.g. entities) as RESTful web services.‣ Provides only RESTful services.‣ Builds upon the Entity API, to provide support for all entity types out of thebox.‣ Currently only CRUD operations supported‣ Currently JSON, XML and RDF/XML are available out of the box.‣ There are no "service endpoints" to configure as resources are just availableat uniform paths like "node/1", "user/1".http://drupal.org/project/restws
  9. 9. RESTful Web Services: Test it!To obtain the JSON representation of an entity use yourbrowser to visit:http://yoursite.com/node/1.json orhttp://yoursite.com/user/1.json orhttp://yoursite.com/<entity type name>/<entity id>.jsonNote: The module will respect your access permissions, so make sure you are logged in.
  10. 10. RESTful Web Services: CRUDSupports full CRUD (Create, Read, Update, Delete) for resources:‣ Create: HTTP PUT /<entity type name> (requires HTTP Content-Type header set to the MIME type of <format>)‣ Read: HTTP GET /<entity type name>/<entity id>.<format> or HTTP GET /<entity type name>/<entity id> (requires HTTP Accept header set to the MIME type of <format>)‣ Update: HTTP POST /<entity type name>/<entity id>.<format> or HTTP POST /<entity type name>/<entity id> (requires HTTP Content-Type header set to the MIME type of the posted format)‣ Delete: HTTP DELETE /<entity type name>/<entity id>Note: The representation <format> can be json, xml etc.
  11. 11. RESTful Web Services: Auth and Perms can be achieved via separate modules, maybe making use of‣ Authenticationthe standard Drupal cookie and session handling.‣ The module comes with an optional HTTP Basic Authentication module(restws_auth_basic) that performs a user login with the credentials providedvia the usual HTTP headers.‣ Theusual Drupal permission system is respected, thus permissions arechecked for the logged in user account of the received requests.
  12. 12. Connector: REST Client
  13. 13. Connector: Example (webform hook)
  14. 14. Connector: Example (response)
  15. 15. Case Study REST Pamm Travel Tikal (Drupal 6) (Drupal 7) Service Service Requester Provider
  16. 16. Case Study REST Intersos Tikal (Drupal 6) (Drupal 7) Service Service Requester Provider
  17. 17. Questions? http://bmeme.com Luca Corbo (lucor) Daniele Piaggesi (g0blin)luca.corbo@bmeme.com daniele.piaggesi@bmeme.com @lucacorbo @g0blin79

×