drupal web services
DESCRIPTION
TRANSCRIPT
Drupal Web Services
Uses of web services
Classifications of web services
Example web service
Types of web services in Drupal
Websites, web apps +
SyndicationInteroperabilityOutsource complexityReuse application componentsMashups and unforeseen...
REST - resource oriented approach...
Method information goes in the HTTP method
Scoping information goes in the URL
HTTP error codes
If you get 200 then all is ok.
If you get 3xx 4xx 5xx then something went wrong.
3xx = it's moved4xx = client error 5xx = server error
404 = not found418 = i'm a teapot 500 = internal server error503 = service unavailable
REST example - Amazon S3
Amazon S3 based on two concepts:
Bucketname
Objectparent bucketvalue (the data)key (name)metadata (key/value pairs)
REST example - Amazon S3
Resources:
List of your bucketshttp://s3.amazonaws.com/
A buckethttp://s3.amazonaws.com/{bucketname}/
An objecthttp://s3.amazonaws.com/{bucketname}/{objectname}
Types of web service in Drupal
Views Datasource(read only)
Views Atom(read only)
Services v3 Services v2
Blog API
Views Atom
Style plugin Alternative Feed style that generates Atom not RSS
RDFNode Row style plugin Serializes arbitrary node to XML, including CCK fields
Useful with Feeds Atom to move content between Drupal sites.
REST on a node
CRUD
create: POST /noderead: GET /node/1 index: GET /nodeupdate: PUT /node/1delete: DELETE /node/1
Services 3 extensions to CRUD
Actions, eg:
POST /node/publish_my_drafts
Targeted actions, eg:
POST /node/1/publish
Relationships, eg:
GET /node/1/comments
Response formats
XMLRPC returns XMLJSONRPC returns JSON
REST format agnostic:
http://example.com/node/1.xml returns XMLhttp://example.com/node/1.json returns JSONhttp://example.com/node/1.php returns serialized-PHP
Links
Serviceshttp://drupal.org/project/servicesViews Datasourcehttp://drupal.org/project/views_datasourceViews Atomhttp://drupal.org/project/views_atomHyper Text Coffee Pot Control Protocol (HTCPCP/1.0)http://tools.ietf.org/html/rfc2324