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.
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. #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
20. Pre-requisites to multichannel distribution
Separation of layout
and content at the 1
content source level
Nicolas Pastorino - IPCse11 30/05/2011 7
21. Pre-requisites to multichannel distribution
Separation of layout
and content at the 1
content source level
Nicolas Pastorino - IPCse11 30/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 - IPCse11 30/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 - IPCse11 30/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 - IPCse11 30/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 - IPCse11 30/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 - IPCse11 30/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.”
51. 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
52. 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
53. REpresentational
State
Transfer
h"p://www.infoq.com/ar4cles/rest-‐introduc4on
h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
54. 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
56. At the core of the eZ Publish CMS
Extensible REST API
REST as a core feature
Nicolas Pastorino - IPCse11 30/05/2011 19
57. At the core of the eZ Publish CMS
Extensible REST API
Dedicated front-controller
Nicolas Pastorino - IPCse11 30/05/2011 20
58. 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
59. 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
60. At the core of the eZ Publish CMS
Extensible REST API
Mapping content into
resources
Nicolas Pastorino - IPCse11 30/05/2011 22
61. At the core of the eZ Publish CMS
Extensible REST API
Makes data available
Nicolas Pastorino - IPCse11 30/05/2011 23
62. At the core of the eZ Publish CMS
Extensible REST API
Makes data reusable
Nicolas Pastorino - IPCse11 30/05/2011 23
63. At the core of the eZ Publish CMS
Extensible REST API
Content is essentially
liberated
Nicolas Pastorino - IPCse11 30/05/2011 24
64. At the core of the eZ Publish CMS
Extensible REST API
URI pattern
Nicolas Pastorino - IPCse11 30/05/2011 25
65. 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
66. 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
67. 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
68. 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
77. 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
90. 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