• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Talking to Web Services
 

Talking to Web Services

on

  • 1,335 views

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 (http://earthdata.nasa.gov/echo) and the Agile Zen project management tool (http://agilezen.com).

Sandboxes for the code demoed in this session are available at:
* ECHO - http://drupal.org/sandbox/dbassendine/1829568
* AgileZen - http://drupal.org/sandbox/dbassendine/1828082

Presented by David Bassendine on 10/27/2012 at Drupalcamp Atlanta (https://www.drupalcampatlanta.com/session/talking-web-services).

Statistics

Views

Total Views
1,335
Views on SlideShare
1,335
Embed Views
0

Actions

Likes
0
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Talking to Web Services Talking to Web Services Presentation Transcript

    • Talking to Web Services The outside world from Drupal
    • Me David Bassendine Senior Developer Day: Mediacurrent Night: Science & Sustainability @dbassendine linkedin.com/in/dbassendine
    • "Web Services"open data: science, gov. & developmentsocial: the big conversationbusiness tools: customers, pm, seo... (very) big data (and growing)
    • compfight.com
    • monitter.com
    • http://goo.gl/bCkJf
    • http://goo.gl/gkuDS
    • agilezen.com
    • campaignmonitor.com image:http://goo.gl/qlQQ8
    • The task ahead ...
    • Creative Commons (CC BY 2.0) by Flickr user mariachily http://goo.gl/iU8aI
    • http://reverb.echo.nasa.gov/
    • agilezen.com
    • Step 0Is there a module for that?
    • Step 1HTTP and REST
    • 1: HTTP Comm.s
    • 1: HTTP Comm.s
    • 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: http://en.wikipedia.org/wiki/Representational_state_transferREST for your wife: http://tomayko.com/writings/rest-to-my-wifeREST hypermedia: http://martinfowler.com/articles/richardsonMaturityModel.html
    • Step 2API DocumentationURLs and path structureAuthenticationResourcesData formats
    • 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) dev.agilezen.com http://goo.gl/b38dJ
    • Step 3Test in the browserGET test (simple URL) – eg. http://goo.gl/XUFtnPOSTer test (browser plugin) – Chrome: XHR POSTer – Firefox: Poster
    • Step 4Plan the approach
    • 4: Approaches Drupal core HTTP http://goo.gl/pnML8 REST API Query API drupal.org/project/ rest_api_query Services Client drupal.org/project/ services_client Feeds (GET only) drupal.org/project/feeds
    • 4: Approaches
    • Step 5Now start to code ...
    • Step 5aDrupal core HTTPDrupal 7Demo: NASA ECHO APIReason for approach: REST but requires XMLCode: http://drupal.org/sandbox/dbassendine/1829568
    • Step 5aDrupal core HTTPPros ConsFlexible More code (169 lines)Well structured Encoding / decoding not inc.request/response Less structural consistency
    • 5a: ECHO API
    • Demo: ECHO API
    • Step 5bREST API Query APIDrupal 6 (Open Atrium)Service: Agile Zen APIReason for approach: REST and supports JSONCode: http://drupal.org/sandbox/dbassendine/1828082
    • Step 5bREST API Query APIPros ConsLess code (114L) No XML supportEncoding / decoding inc. AssumptionsMore structuralconsistency
    • 5b: Agile Zen API
    • Demo: Agile Zen API
    • Creative Commons (CC BY 2.0) by Flickr user Paxson Woelber http://goo.gl/MYPeM
    • Where next?Triggers Internal ExportCore hooks Logging Views w/ Data moduleRules Job Scheduler Queue
    • Skills & resourcesHTTP protocol http://www.jmarshall.com/easy/httpREST http://rest.elkstein.orgSimpleXML http://goo.gl/IvaKX (php.net)json_encode/decode http://goo.gl/lKHZ (php.net)Drupal core HTTP http://goo.gl/pnML8 (d.o)Drupal REST API Query API drupal.org/project/rest_api_query