0
Drupal ServicesYuriy Gerasimovemail: yuri.gerasimov@gmail.comtwitter: ygerasimovd.o.: http://drupal.org/user/257311
Presentation planWhat is Services for?Building REST interface with ServicesResources out-of-box.Services APIFuture of Serv...
Architechture
ServicesMove from RPC style to RESTREST GET safe method (only to retrieve) PUT and DELETE are idempotent methods (multiple...
Services 3.xresource oriented (CRUD = create, retrieve,update, delete, index)Content Typedifferent formatters (php, json, ...
Content TypeRequest: URL, headers, bodyContent-type: application/x-www-form-urlencodedkey1=value1&key2=value2&key3[0]=a&ke...
RoutingPicture from WSCCI proposal http://groups.drupal.org/node/226479
REST with ServicesCreate   POST     http://host/rest/node.jsonRetrieve GET      http://host/rest/node/5.jsonUpdate PUT    ...
REST with ServicesAction    POST http://host/rest/user/login.jsonTargeted Action    POST http://host/rest/node/5/vote.json...
Services 3.x resourcesNode resourceTaxonomy vocabulary resource (getTree)Taxonomy term resource (selectNodes)User resource...
Services 3.x resourcesFile resource (CRUD) (nodeFiles)
Services 3.x hook_services_resources
Services 3.x hook_services_resources
Services 3.x REST server formattershttp://<your_domain>/<your_endpoint_path>/<your_resource_path>.<formatter>Standard: php...
Build REST interfaceImplement CRUD functionality. Use actions, relationshipsresource/node/X/commentsUse aliases if needed....
WSCCIUse Symfony componentsContext (HttpFoundation)Rounting (HttpKernel)Lazy loading
Tools & ResourcesPoster https://addons.mozilla.org/en-US/firefox/addon/2691Services Handbook http://drupal.org/handbook/mo...
QuestionsYuriy Gerasimovemail: yuri.gerasimov@gmail.comtwitter/irc: ygerasimovd.o.: http://drupal.org/user/257311
Upcoming SlideShare
Loading in...5
×

Services Stanford 2012

1,110

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,110
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Services Stanford 2012"

  1. 1. Drupal ServicesYuriy Gerasimovemail: yuri.gerasimov@gmail.comtwitter: ygerasimovd.o.: http://drupal.org/user/257311
  2. 2. Presentation planWhat is Services for?Building REST interface with ServicesResources out-of-box.Services APIFuture of Services
  3. 3. Architechture
  4. 4. ServicesMove from RPC style to RESTREST GET safe method (only to retrieve) PUT and DELETE are idempotent methods (multiple calls should have same result)
  5. 5. Services 3.xresource oriented (CRUD = create, retrieve,update, delete, index)Content Typedifferent formatters (php, json, jsonp, xml, ...)separate endpoints (exportable to features)authentication
  6. 6. Content TypeRequest: URL, headers, bodyContent-type: application/x-www-form-urlencodedkey1=value1&key2=value2&key3[0]=a&key3[1]=b&key3[2]=cContent-type: application/json{"key1":"value1","key2":"value2","key3":["a","b","c"]}
  7. 7. RoutingPicture from WSCCI proposal http://groups.drupal.org/node/226479
  8. 8. REST with ServicesCreate POST http://host/rest/node.jsonRetrieve GET http://host/rest/node/5.jsonUpdate PUT http://host/rest/node/5.jsonDelete DELETE http://host/rest/node/5.jsonIndex GET http://host.com/rest/node.json
  9. 9. REST with ServicesAction POST http://host/rest/user/login.jsonTargeted Action POST http://host/rest/node/5/vote.jsonRelation GET http://host/rest/node/5/files.json
  10. 10. Services 3.x resourcesNode resourceTaxonomy vocabulary resource (getTree)Taxonomy term resource (selectNodes)User resource (login, logout, register) Comment resource (loadNodeComments,countAll, countNew)System resource (no CRUD) (connect,get_variable, set_variable)
  11. 11. Services 3.x resourcesFile resource (CRUD) (nodeFiles)
  12. 12. Services 3.x hook_services_resources
  13. 13. Services 3.x hook_services_resources
  14. 14. Services 3.x REST server formattershttp://<your_domain>/<your_endpoint_path>/<your_resource_path>.<formatter>Standard: php, json, jsonp, xml, yaml, bencode (see RESTServerViewBuiltIn)
  15. 15. Build REST interfaceImplement CRUD functionality. Use actions, relationshipsresource/node/X/commentsUse aliases if needed.Write testsFor public GET calls you can use Views + ViewsDatasource
  16. 16. WSCCIUse Symfony componentsContext (HttpFoundation)Rounting (HttpKernel)Lazy loading
  17. 17. Tools & ResourcesPoster https://addons.mozilla.org/en-US/firefox/addon/2691Services Handbook http://drupal.org/handbook/modules/servicesTestsA future of Services http://goodold.se/blog/tech/future-services-3xGroups http://groups.drupal.org/servicesWSCCI http://groups.drupal.org/wscci
  18. 18. QuestionsYuriy Gerasimovemail: yuri.gerasimov@gmail.comtwitter/irc: ygerasimovd.o.: http://drupal.org/user/257311
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×