Your SlideShare is downloading. ×
Talking to Web Services
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Talking to Web Services


Published on

Web services are a treasure trove of tools, content and data. I'll be exploring how we can use Drupal's frameworks to tap into these services. From strategy and selecting the right approach, to …

Web services are a treasure trove of tools, content and data. I'll be exploring how we can use Drupal's frameworks to tap into these services. From strategy and selecting the right approach, to triggering, encoding and sending HTTP messages, I'll walk through how you might go about writing a custom integration that puts your Drupal build into a conversation with the outside world. I'll follow up with real world examples I've built to interact with NASA's ECHO Earth science data service ( and the Agile Zen project management tool (

Sandboxes for the code demoed in this session are available at:
* ECHO -
* AgileZen -

Presented by David Bassendine on 10/27/2012 at Drupalcamp Atlanta (

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Talking to Web Services The outside world from Drupal
  • 2. Me David Bassendine Senior Developer Day: Mediacurrent Night: Science & Sustainability @dbassendine
  • 3. "Web Services"open data: science, gov. & developmentsocial: the big conversationbusiness tools: customers, pm, seo... (very) big data (and growing)
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. image:
  • 10. The task ahead ...
  • 11. Creative Commons (CC BY 2.0) by Flickr user mariachily
  • 12.
  • 13.
  • 14. Step 0Is there a module for that?
  • 15. Step 1HTTP and REST
  • 16. 1: HTTP Comm.s
  • 17. 1: HTTP Comm.s
  • 18. 1: REST architectures REST SOAP (XMLRPC)Resources URIs Custom (data packet)Methods HTTP verbs Custom (data packet)Errors HTTP codes Custom (data packet)Data encoding JSON / XML XML Consistent*, chatty Flexible but inconsistentREST vs/ SOAP: for your wife: hypermedia:
  • 19. Step 2API DocumentationURLs and path structureAuthenticationResourcesData formats
  • 20. 2: API Documentation Agile Zen ECHOURL Structure RESTful RESTfulAuthentication Required: Header or Not required for search Parameter tokenResources Stories, Projects ... Datasets, Granules...Data formats JSON XML JSON/XML (GET) XML AQL (POST)
  • 21. Step 3Test in the browserGET test (simple URL) – eg. test (browser plugin) – Chrome: XHR POSTer – Firefox: Poster
  • 22. Step 4Plan the approach
  • 23. 4: Approaches Drupal core HTTP REST API Query API rest_api_query Services Client services_client Feeds (GET only)
  • 24. 4: Approaches
  • 25. Step 5Now start to code ...
  • 26. Step 5aDrupal core HTTPDrupal 7Demo: NASA ECHO APIReason for approach: REST but requires XMLCode:
  • 27. Step 5aDrupal core HTTPPros ConsFlexible More code (169 lines)Well structured Encoding / decoding not inc.request/response Less structural consistency
  • 28. 5a: ECHO API
  • 29. Demo: ECHO API
  • 30. Step 5bREST API Query APIDrupal 6 (Open Atrium)Service: Agile Zen APIReason for approach: REST and supports JSONCode:
  • 31. Step 5bREST API Query APIPros ConsLess code (114L) No XML supportEncoding / decoding inc. AssumptionsMore structuralconsistency
  • 32. 5b: Agile Zen API
  • 33. Demo: Agile Zen API
  • 34. Creative Commons (CC BY 2.0) by Flickr user Paxson Woelber
  • 35. Where next?Triggers Internal ExportCore hooks Logging Views w/ Data moduleRules Job Scheduler Queue
  • 36. Skills & resourcesHTTP protocol http://rest.elkstein.orgSimpleXML ( ( core HTTP (d.o)Drupal REST API Query API