Talk given at the Dutch PHP Conference 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.
3. #dpc11
Launching
content in
mobility with
Mobile
REST &
Dutch PHP Conference 2011 - Amsterdam - May 21st
eZ Publish
Nicolas Pastorino - nfrp@ez.no
Director Community - eZ Systems
@jeanvoye - http://share.ez.no
4. #dpc11
Launching
content in
mobility with
Mobile
REST &
Dutch PHP Conference 2011 - Amsterdam - May 21st
eZ Publish
Nicolas Pastorino - nfrp@ez.no
Director Community - eZ Systems
@jeanvoye - http://share.ez.no
20. Pre-requisites to multichannel distribution
Separation of layout
and content at the 1
content source level
Nicolas Pastorino - DPC11 21/05/2011 7
21. Pre-requisites to multichannel distribution
Separation of layout
and content at the 1
content source level
Nicolas Pastorino - DPC11 21/05/2011 7
22. 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 - DPC11 21/05/2011 7
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
Nicolas Pastorino - DPC11 21/05/2011 7
24. 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 - DPC11 21/05/2011 7
25. 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 - DPC11 21/05/2011 7
26. 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 - DPC11 21/05/2011 7
32. Monetized
Content
Streams
Single
Content
Source / CMS
33. Monetized
Content
Streams
Mobile
Applications
Single
/
Smartphones, Tablets
Content
Source
CMS
34. Monetized
Content
Streams
Mobile
Applications
Single
/
Smartphones, Tablets
Content
Source
CMS Push 3rd party
CRM, ERP
Content
Newsletters
35. Monetized
Content
Streams
Mobile
Applications
Single
/
Smartphones, Tablets
Content
Source
CMS Push 3rd party
CRM, ERP
Content
Newsletters
Print
Legacy publication chains
36. Monetized
Content
Streams
Mobile
Applications
Single
/
Smartphones, Tablets
Content
Source
CMS Push 3rd party
CRM, ERP
Content
Newsletters
Print
Legacy publication chains
Social Media
37.
38. "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."
41. Having a
REST ?
:)
A touch
more of
insight will
help...
42.
43. “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.”
53. 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
• Use standard methods
• Resources with multiple representations
• Communicate statelessly
54. 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
• 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
55. REpresentational
State
Transfer
h"p://www.infoq.com/ar4cles/rest-‐introduc4on
h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
56. 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
58. At the core of the eZ Publish CMS
Extensible REST API
REST as a core feature
Nicolas Pastorino - DPC11 21.05.2011 19
59. At the core of the eZ Publish CMS
Extensible REST API
Dedicated front-controller
Nicolas Pastorino - DPC11 21.05.2011 20
60. At the core of the eZ Publish CMS
Extensible REST API
REST setup
REST
eZP
REST
request
FC
eZ
Publish
web-‐request
Nicolas Pastorino - DPC11 21.05.2011 21
61. At the core of the eZ Publish CMS
Extensible REST API
REST setup
REST
eZP
REST
request
FC
eZ
Publish
web-‐request
Nicolas Pastorino - DPC11 21.05.2011 21
62. At the core of the eZ Publish CMS
Extensible REST API
Mapping content into
resources
Nicolas Pastorino - DPC11 21.05.2011 22
63. At the core of the eZ Publish CMS
Extensible REST API
Makes data available
Nicolas Pastorino - DPC11 21.05.2011 23
64. At the core of the eZ Publish CMS
Extensible REST API
Makes data reusable
Nicolas Pastorino - DPC11 21.05.2011 23
65. At the core of the eZ Publish CMS
Extensible REST API
Content is essentially
liberated
Nicolas Pastorino - DPC11 21.05.2011 24
66. At the core of the eZ Publish CMS
Extensible REST API
URI pattern
Nicolas Pastorino - DPC11 21.05.2011 25
67. 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 - DPC11 21.05.2011 26
68. At the core of the eZ Publish CMS
Extensible REST API
Just a token to trigger your rewrite rule
Prefix Provider Version
ezpRestPrefixFilterInterface
Nicolas Pastorino - DPC11 21.05.2011 26
69. At the core of the eZ Publish CMS
Extensible REST API
Prefix Just a token to trigger your rewrite rule
Provider Version
ezpRestPrefixFilterInterface
Nicolas Pastorino - DPC11 21.05.2011 26
70. At the core of the eZ Publish CMS
Extensible REST API
Prefix Just a token to trigger your rewrite rule
Provider Version
ezpRestPrefixFilterInterface
Nicolas Pastorino - DPC11 21.05.2011 26
71. 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 - DPC11 21.05.2011 26
72. 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 - DPC11 21.05.2011 26
73. 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 - DPC11 21.05.2011 26
82. 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 - DPC11 21.05.2011 35
95. Find me on Twitter : @jeanvoye
Rate this talk : http://joind.in/talk/view/3255,
Slides available soon at http://slideshare.net/jeanvoye
eZ Conference, June 16th&17th, London :
Rasmus Lerdorf,
Derick Rethans,
Thank you !
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
http://share.ez.no/download & http://share.ez.no/get-involved
eZ Systems & eZ Publish Enterprise Edition
http://ez.no