SlideShare a Scribd company logo
1 of 45
Download to read offline
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. & development

social: the big conversation

business 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 0



Is there a module for that?
Step 1



HTTP 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 inconsistent




REST vs/ SOAP: http://en.wikipedia.org/wiki/Representational_state_transfer
REST for your wife: http://tomayko.com/writings/rest-to-my-wife
REST hypermedia: http://martinfowler.com/articles/richardsonMaturityModel.html
Step 2

API Documentation
URLs and path structure
Authentication

Resources

Data formats
2: API Documentation

                 Agile Zen               ECHO
URL Structure    RESTful                 RESTful
Authentication   Required: Header or     Not required for search
                 Parameter token
Resources        Stories, Projects ...   Datasets, Granules...
Data formats     JSON XML                JSON/XML (GET)
                                         XML AQL (POST)
                 dev.agilezen.com        http://goo.gl/b38dJ
Step 3

Test in the browser
GET test (simple URL) – eg. http://goo.gl/XUFtn

POSTer test (browser plugin) – Chrome: XHR POSTer
                             – Firefox: Poster
Step 4



Plan 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 5



Now start to code ...
Step 5a

Drupal core HTTP
Drupal 7
Demo: NASA ECHO API

Reason for approach: REST but requires XML

Code: http://drupal.org/sandbox/dbassendine/1829568
Step 5a

Drupal core HTTP
Pros               Cons
Flexible           More code (169 lines)

Well structured    Encoding / decoding not inc.
request/response
                   Less structural consistency
5a: ECHO API
Demo: ECHO API
Step 5b

REST API Query API
Drupal 6 (Open Atrium)
Service: Agile Zen API

Reason for approach: REST and supports JSON

Code: http://drupal.org/sandbox/dbassendine/1828082
Step 5b

REST API Query API
Pros                       Cons
Less code (114L)           No XML support

Encoding / decoding inc.   Assumptions
More structural
consistency
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        Export

Core hooks   Logging         Views w/
                             Data module
Rules        Job Scheduler
             Queue
Skills & resources
HTTP protocol               http://www.jmarshall.com/easy/http

REST                                     http://rest.elkstein.org

SimpleXML                          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
Talking to Web Services

More Related Content

What's hot

How to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryHow to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryTareq Hasan
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHPLearn How To Develop With CakePHP
Learn How To Develop With CakePHPMichael Bourque
 
Cross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORSCross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORSMichael Neale
 
Get happy Editors with a suitable TYPO3 Backend Configuration
Get happy Editors with a suitable TYPO3 Backend ConfigurationGet happy Editors with a suitable TYPO3 Backend Configuration
Get happy Editors with a suitable TYPO3 Backend ConfigurationPeter Kraume
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupalsparkfabrik
 
Use FLUID templating for your TYPO3 search
Use FLUID templating for your TYPO3 searchUse FLUID templating for your TYPO3 search
Use FLUID templating for your TYPO3 searchtimohund
 
CORS - Enable Alfresco for CORS
CORS - Enable Alfresco for CORSCORS - Enable Alfresco for CORS
CORS - Enable Alfresco for CORSJared Ottley
 
J M Githeko Agenda Software installation – Apche, MySQL, PHP
J M Githeko Agenda Software installation – Apche, MySQL, PHPJ M Githeko Agenda Software installation – Apche, MySQL, PHP
J M Githeko Agenda Software installation – Apche, MySQL, PHPwebhostingguy
 
An introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsAn introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsmrdon
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: BackendVõ Duy Tuấn
 
India Pr Wire May 11, 2009 Sensex Down 193 Points On Profit Booking
India Pr Wire May 11, 2009 Sensex Down 193 Points On Profit BookingIndia Pr Wire May 11, 2009 Sensex Down 193 Points On Profit Booking
India Pr Wire May 11, 2009 Sensex Down 193 Points On Profit BookingJagannadham Thunuguntla
 
The Zeitgeist Movement
The Zeitgeist MovementThe Zeitgeist Movement
The Zeitgeist Movementguest915c8c5
 
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicy
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicyBrowsers_SameOriginPolicy_CORS_ContentSecurityPolicy
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicysubbul
 

What's hot (16)

Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
 
How to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryHow to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org Repository
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHPLearn How To Develop With CakePHP
Learn How To Develop With CakePHP
 
Cross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORSCross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORS
 
Get happy Editors with a suitable TYPO3 Backend Configuration
Get happy Editors with a suitable TYPO3 Backend ConfigurationGet happy Editors with a suitable TYPO3 Backend Configuration
Get happy Editors with a suitable TYPO3 Backend Configuration
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupal
 
Use FLUID templating for your TYPO3 search
Use FLUID templating for your TYPO3 searchUse FLUID templating for your TYPO3 search
Use FLUID templating for your TYPO3 search
 
CORS - Enable Alfresco for CORS
CORS - Enable Alfresco for CORSCORS - Enable Alfresco for CORS
CORS - Enable Alfresco for CORS
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
J M Githeko Agenda Software installation – Apche, MySQL, PHP
J M Githeko Agenda Software installation – Apche, MySQL, PHPJ M Githeko Agenda Software installation – Apche, MySQL, PHP
J M Githeko Agenda Software installation – Apche, MySQL, PHP
 
An introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsAn introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applications
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: Backend
 
India Pr Wire May 11, 2009 Sensex Down 193 Points On Profit Booking
India Pr Wire May 11, 2009 Sensex Down 193 Points On Profit BookingIndia Pr Wire May 11, 2009 Sensex Down 193 Points On Profit Booking
India Pr Wire May 11, 2009 Sensex Down 193 Points On Profit Booking
 
The Zeitgeist Movement
The Zeitgeist MovementThe Zeitgeist Movement
The Zeitgeist Movement
 
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicy
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicyBrowsers_SameOriginPolicy_CORS_ContentSecurityPolicy
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicy
 

Viewers also liked

Viewers also liked (8)

Aguado sanchez victoria_deit_tarea_1_1
Aguado sanchez victoria_deit_tarea_1_1Aguado sanchez victoria_deit_tarea_1_1
Aguado sanchez victoria_deit_tarea_1_1
 
RESTful Web Services and Drupal
RESTful Web Services and DrupalRESTful Web Services and Drupal
RESTful Web Services and Drupal
 
Advanced theming
Advanced themingAdvanced theming
Advanced theming
 
ŠIMTAS ŠYPSENŲ' 13
ŠIMTAS ŠYPSENŲ' 13ŠIMTAS ŠYPSENŲ' 13
ŠIMTAS ŠYPSENŲ' 13
 
Staff & Volunteers -
Staff & Volunteers  -Staff & Volunteers  -
Staff & Volunteers -
 
Drupal Rules!
Drupal Rules!Drupal Rules!
Drupal Rules!
 
Dig into the omega theme
Dig into the omega themeDig into the omega theme
Dig into the omega theme
 
Designing for Content Management Systems
Designing for Content Management SystemsDesigning for Content Management Systems
Designing for Content Management Systems
 

Similar to Talking to Web Services

The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Startedguest1af57e
 
High Availability by Design
High Availability by DesignHigh Availability by Design
High Availability by DesignDavid Prinzing
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Tony Frame
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesciklum_ods
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfonyFrancois Zaninotto
 
RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!Dmytro Olaresko
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with PythonBrian Lyttle
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopJimmy Guerrero
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTPMykhailo Kolesnyk
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsIdo Flatow
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Sumy PHP User Grpoup
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Tim Burks
 

Similar to Talking to Web Services (20)

Gohan
GohanGohan
Gohan
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
 
High Availability by Design
High Availability by DesignHigh Availability by Design
High Availability by Design
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
URL Design
URL DesignURL Design
URL Design
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js Workshop
 
11 asp.net web api
11 asp.net web api11 asp.net web api
11 asp.net web api
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)
 
Introduction to python scrapping
Introduction to python scrappingIntroduction to python scrapping
Introduction to python scrapping
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
 

Talking to Web Services