Successfully reported this slideshow.
Your SlideShare is downloading. ×

IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Download to read offline

Talk given at the International PHP Conference, spring edition, 2011.

Pure-web is not an option anymore when publishing content: addressing the broader internet and its multiple channels is key to a great diffusion. As a Content Management Platform, eZ Publish now exposes an extensible REST API for mobile devices to consume and create content. This session will show how content & functionalities are made available to mobile applications on such platforms as Android phones, iPhones, iPads and tablets.

Talk given at the International PHP Conference, spring edition, 2011.

Pure-web is not an option anymore when publishing content: addressing the broader internet and its multiple channels is key to a great diffusion. As a Content Management Platform, eZ Publish now exposes an extensible REST API for mobile devices to consume and create content. This session will show how content & functionalities are made available to mobile applications on such platforms as Android phones, iPhones, iPads and tablets.

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

  1. 1. Launching content in mobility with REST & eZ Publish
  2. 2. Launching content in mobility with REST & eZ Publish Nicolas Pastorino - nfrp@ez.no Director Community - eZ Systems @jeanvoye - http://share.ez.no
  3. 3. #ipcse11 Launching content in mobility with Mobile REST & International PHP Conference, SE 2011 - Berlin - May 30th eZ Publish Nicolas Pastorino - nfrp@ez.no Director Community - eZ Systems @jeanvoye - http://share.ez.no
  4. 4. #ipcse11 Launching content in mobility with Mobile REST & International PHP Conference, SE 2011 - Berlin - May 30th eZ Publish Nicolas Pastorino - nfrp@ez.no Director Community - eZ Systems @jeanvoye - http://share.ez.no
  5. 5. Our agenda :
  6. 6. Our agenda : Multichannel : why ?
  7. 7. Our agenda : Multichannel : why ? REST
  8. 8. Our agenda : Multichannel : why ? REST Extensible REST API
  9. 9. Our agenda : Multichannel : why ? REST Extensible REST API Demo
  10. 10. Multichannel : why ? 3
  11. 11. How would you feel playing Pacman on a single, straight line of dots ?
  12. 12. How would you feel playing Pacman on a single, straight line of dots ?
  13. 13. How would you feel playing Boring, Pacman on a right ? line single, straight of dots ?
  14. 14. Multichannel content distribution is the real Pacman
  15. 15. Multichannel content distribution is the real Pacman
  16. 16. Pre-requisites to multichannel distribution Nicolas Pastorino - IPCse11 30/05/2011 7
  17. 17. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level Nicolas Pastorino - IPCse11 30/05/2011 7
  18. 18. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level Nicolas Pastorino - IPCse11 30/05/2011 7
  19. 19. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level Do not compromise on user experience 2 Nicolas Pastorino - IPCse11 30/05/2011 7
  20. 20. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level “The Superman Effect” Aral Balkan, DPC11 Do not compromise on user experience 2 Nicolas Pastorino - IPCse11 30/05/2011 7
  21. 21. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level “The Superman Effect” Aral Balkan, DPC11 Do not compromise on user experience 2 “There is a lot of effort going into improving customer experience. It is key to get consistency across different channels so their experience does not vary” Jim Daviesni Nicolas Pastorino - IPCse11 30/05/2011 7
  22. 22. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level “The Superman Effect” Aral Balkan, DPC11 Do not compromise on user experience 2 “There is a lot of effort going into improving customer experience. It is key to get consistency across different channels so their Have a single source experience does not vary” Jim Daviesni of content 3 Nicolas Pastorino - IPCse11 30/05/2011 7
  23. 23. Pre-requisites to multichannel distribution Separation of layout and content at the 1 content source level “The Superman Effect” Aral Balkan, DPC11 Do not compromise on user experience 2 “There is a lot of effort going into improving customer experience. It is key to get consistency across different channels so their Have a single source experience does not vary” Jim Daviesni of content 3 “Publishers usually can't afford a dedicated editorial team per channel” Nicolas Pastorino - IPCse11 30/05/2011 7
  24. 24. Are 3 rules of thumb enough ?
  25. 25. Are 3 rules of thumb enough We’re ? hardly off the ground. Let’s dig further...
  26. 26. Single Content Source / CMS
  27. 27. Single Content Source / CMS
  28. 28. Monetized Content Streams Single Content Source / CMS
  29. 29. Monetized Content Streams Mobile Applications Single / Smartphones, Tablets Content Source CMS
  30. 30. Monetized Content Streams Mobile Applications Single / Smartphones, Tablets Content Source CMS Push 3rd party CRM, ERP Content Newsletters
  31. 31. Monetized Content Streams Mobile Applications Single / Smartphones, Tablets Content Source CMS Push 3rd party CRM, ERP Content Newsletters Print Legacy publication chains
  32. 32. Monetized Content Streams Mobile Applications Single / Smartphones, Tablets Content Source CMS Push 3rd party CRM, ERP Content Newsletters Print Legacy publication chains Social Media
  33. 33. "Multichannel media consumers have higher levels of engagement than those present in only one channel. The more one watches TV, listens to the radio, spends time online, etc., the more advertising they consume. This shows that multichannel content distribution will also have an important impact on the publishers revenue structure. It will evolve to become a competitive, critical, enabling technology for marketing communications."
  34. 34. Having a REST ? :)
  35. 35. Having a REST ? :) A touch more of insight will help...
  36. 36. “Media companies as well as consumer brands must recognize that adding mobile to the multichannel mix does not mean creating a mini-channel. Those building mobile strategies should recognize that: • Mobile is not just about shrinking the desktop experience, • The user environment is an element of the mobile experience, • Mobile users are not simply a subset of online users – some are new.”
  37. 37. Least Common Denominator :
  38. 38. Least Common Denominator : a REST API
  39. 39. Those were the basics to increase your REACH through multiple channels
  40. 40. REST 15
  41. 41. REpresentational State Transfer
  42. 42. REpresentational State Transfer REST is a set of principles that define how Web standards, such as HTTP and URIs, are supposed to be used. • Give every “thing” an ID • Link things together (“HATEOAS”) • Use standard methods • Resources with multiple representations • Communicate statelessly
  43. 43. REpresentational State Transfer REST is a set of principles that define how Web standards, such as HTTP and URIs, are supposed to be used. • Give every “thing” an ID • Link things together (“HATEOAS”) • Use standard methods • Resources with multiple representations • Communicate statelessly h"p://www.infoq.com/ar4cles/rest-­‐introduc4on h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
  44. 44. REpresentational State Transfer h"p://www.infoq.com/ar4cles/rest-­‐introduc4on h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
  45. 45. REpresentational State Transfer Key goals of REST include: • Scalability of component interactions • Generality of interfaces • Independent deployment of components • Intermediary components to reduce latency, enforce security and encapsulate legacy systems h"p://www.infoq.com/ar4cles/rest-­‐introduc4on h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
  46. 46. Extensible REST API at the core of the eZ Publish CMS 18
  47. 47. At the core of the eZ Publish CMS Extensible REST API REST as a core feature Nicolas Pastorino - IPCse11 30/05/2011 19
  48. 48. At the core of the eZ Publish CMS Extensible REST API Dedicated front-controller Nicolas Pastorino - IPCse11 30/05/2011 20
  49. 49. At the core of the eZ Publish CMS Extensible REST API REST setup REST eZP REST  request FC eZ  Publish web-­‐request Nicolas Pastorino - IPCse11 30/05/2011 21
  50. 50. At the core of the eZ Publish CMS Extensible REST API REST setup REST eZP REST  request FC eZ  Publish web-­‐request Nicolas Pastorino - IPCse11 30/05/2011 21
  51. 51. At the core of the eZ Publish CMS Extensible REST API Mapping content into resources Nicolas Pastorino - IPCse11 30/05/2011 22
  52. 52. At the core of the eZ Publish CMS Extensible REST API Makes data available Nicolas Pastorino - IPCse11 30/05/2011 23
  53. 53. At the core of the eZ Publish CMS Extensible REST API Makes data reusable Nicolas Pastorino - IPCse11 30/05/2011 23
  54. 54. At the core of the eZ Publish CMS Extensible REST API Content is essentially liberated Nicolas Pastorino - IPCse11 30/05/2011 24
  55. 55. At the core of the eZ Publish CMS Extensible REST API URI pattern Nicolas Pastorino - IPCse11 30/05/2011 25
  56. 56. At the core of the eZ Publish CMS Extensible REST API Just a token to trigger your rewrite rule Call + GET Host / Prefix / Provider / Version / params ezpRestPrefixFilterInterface Nicolas Pastorino - IPCse11 30/05/2011 26
  57. 57. At the core of the eZ Publish CMS Extensible REST API Prefix Just a token to trigger your rewrite rule Provider ezpRestPrefixFilterInterface Version Nicolas Pastorino - IPCse11 30/05/2011 26
  58. 58. At the core of the eZ Publish CMS Extensible REST API Prefix Just a token to trigger your rewrite rule Provider ezpRestPrefixFilterInterface Version Nicolas Pastorino - IPCse11 30/05/2011 26
  59. 59. At the core of the eZ Publish CMS Extensible REST API Prefix Just a token to trigger your rewrite rule Provider ezpRestPrefixFilterInterface Version Nicolas Pastorino - IPCse11 30/05/2011 26
  60. 60. Prefix filter ezpRestPrefixFilterInterface Current provider Current parsed version value Nicolas Pastorino - IPCse11 30/05/2011 27
  61. 61. Versioned API class ezpRestRouter extends ezcMvcRouter { public function createRoutes() { // ezpRestApiProvider $routes = array( new ezcMvcRailsRoute( '/content/node/:nodeId/listAtom', 'ezpRestAtomController', 'collection' ), new ezcMvcRailsRoute( '/content/node/:nodeId/list', 'ezpRestContentController', 'list' ), new ezcMvcRailsRoute( '/content/node/:nodeId', 'ezpRestContentController', 'viewContent' ), new ezcMvcRailsRoute( '/content/node/:nodeId/fields', 'ezpRestContentController', 'viewFields' ), new ezcMvcRailsRoute( '/content/node/:nodeId/field/:fieldIdentifier', 'ezpRestContentController', 'viewField' ), new ezcMvcRailsRoute( '/content/object/:objectId', 'ezpRestContentController', 'viewContent' ), new ezcMvcRailsRoute( '/content/object/:objectId/fields', 'ezpRestContentController', 'viewFields' ), new ezcMvcRailsRoute( '/content/object/:objectId/field/:fieldIdentifier', 'ezpRestContentController', 'viewField' ), new ezpRestVersionedRoute( new ezcMvcRailsRoute( '/foo', 'myController', 'myActionOne' ), 1 ), new ezpRestVersionedRoute( new ezcMvcRailsRoute( 'e/foo', 'myController2 or myControlerWhichExtendsmyController', 'myBetterAndScalingAction' ), 2 ), ); return ezcMvcRouter::prefix( '/api', $routes ); } } Nicolas Pastorino - IPCse11 30/05/2011 28
  62. 62. Versioned API ezpRestVersionedRoute Version makes the notion version a part of the routing decision Nicolas Pastorino - IPCse11 30/05/2011 29
  63. 63. At the core of the eZ Publish CMS Extensible REST API Build your own flavor, extend the interface(s) Nicolas Pastorino - IPCse11 30/05/2011 30
  64. 64. Extending the interface REST providers Nicolas Pastorino - IPCse11 30/05/2011 31
  65. 65. Extending the interface ezpRestProviderInterface Nicolas Pastorino - IPCse11 30/05/2011 32
  66. 66. Overview of hooks the places where you can go wild.
  67. 67. Nicolas Pastorino - IPCse11 30/05/2011 34
  68. 68. Route setup - Example class ezpRestRouter extends ezcMvcRouter { public function createRoutes() { $providerRoutes = ezpRestProvider::getProvider ( ezpRestPrefixFilterInterface::getApiProviderName() )->getRoutes(); $routes = array( new ezpMvcRailsRoute( '/fatal', 'ezpRestErrorController', 'show' ), new ezpMvcRailsRoute( '/http-basic-auth', 'ezpRestAuthController', 'basicAuth' ), new ezpMvcRailsRoute( '/login/oauth', 'ezpRestAuthController', 'oauthRequired' ), new ezpMvcRailsRoute( '/oauth/token', 'ezpRestOauthTokenController', 'handleRequest'), // ezpRestVersionedRoute( $route, $version ) // $version == 1 should be the same as if the only the $route had been present new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/foo', 'myController', 'myActionOne' ), 1 ), new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/foo', 'myController', 'myActionOneBetter' ), 2 ), ); return ezcMvcRouter::prefix( '/api', array_merge( $providerRoutes, $routes ) ); } } Nicolas Pastorino - IPCse11 30/05/2011 35
  69. 69. Extensible REST API Key features 36
  70. 70. Key features Extensible REST API Content resources Nicolas Pastorino - IPCse11 30/05/2011 37
  71. 71. Key features GET /[api]/v1/content/object/ <objectId>/fields HTTP/1.1 Nicolas Pastorino - IPCse11 30/05/2011 38
  72. 72. Key features fields/<fieldname> type (datatype string) identifier (attribute identifier) value (string representation of data) id (object attribute numerical ID) classattribute_id (class attribute numerical ID) Nicolas Pastorino - IPCse11 30/05/2011 39
  73. 73. Key features GET /[api]/v1/content/object/ <objectId>/field/ <FieldIdentifier> HTTP/1.1 Nicolas Pastorino - IPCse11 30/05/2011 40
  74. 74. Demo Web + Android, eZ Publish powered 41
  75. 75. Famous Last Slides 42
  76. 76. RECAP Multichannel : why ? REST Extensible REST API Demo
  77. 77. You won’t ever play Pacman the same way again :)
  78. 78. You won’t ever play Pacman the same way again :)
  79. 79. You won’t ever play Pacman the same way again :)
  80. 80. Find me on Twitter : @jeanvoye Rate this talk : http://joind.in/3482 Slides available soon at http://slideshare.net/jeanvoye eZ Conference, June 16th&17th, London : Rasmus Lerdorf, Derick Rethans, Tobias Schlitt Get a 20% off coupon at the eZ booth in the hall, and register : http://london2011.ez.no eZ Community http://share.ez.no eZ Publish Community Project https://github.com/ezsystems/ezpublish Thank you ! http://share.ez.no/download http://share.ez.no/get-involved eZ Systems & eZ Publish Enterprise Edition http://ez.no

×