nicolas pastorino - launching content in mobility with rest & ez publish

95
Launching content in mobility with REST & eZ Publish

Upload: nicolas-pastorino

Post on 01-Nov-2014

889 views

Category:

Technology


0 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Launching content in mobility withREST & eZ Publish

Page 2: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Launching content in mobility withREST & eZ Publish

Nicolas Pastorino - [email protected] Community - eZ Systems@jeanvoye - http://share.ez.no

Page 3: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Mobile

Launching content in mobility withREST & eZ Publish

Nicolas Pastorino - [email protected] Community - eZ Systems@jeanvoye - http://share.ez.no

Dutch PHP Conference 2011 - Amsterdam - May 21st

#dpc11

Page 4: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Mobile

Launching content in mobility withREST & eZ Publish

Nicolas Pastorino - [email protected] Community - eZ Systems@jeanvoye - http://share.ez.no

Dutch PHP Conference 2011 - Amsterdam - May 21st

#dpc11

Page 5: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Our agenda :

Page 6: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel : why ?Our agenda :

Page 7: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel : why ?REST

Our agenda :

Page 8: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel : why ?REST

Extensible REST API

Our agenda :

Page 9: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel : why ?REST

Extensible REST APIDemo

Our agenda :

Page 10: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel : why ?

3

Page 11: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 12: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

How would you feel playing Pacman on a single, straight line of dots ?

Page 13: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

How would you feel playing Pacman on a single, straight line of dots ?

Page 14: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

How would you feel playing Pacman on a single, straight line of dots ?

Boring,right ?

Page 15: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 16: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel content distribution is the real Pacman

Page 17: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel content distribution is the real Pacman

Page 18: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 19: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

Page 20: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

Separation of layout and content at the content source level

1

Page 21: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

Separation of layout and content at the content source level

1

Page 22: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

Separation of layout and content at the content source level

1

Do not compromise on user experience 2

Page 23: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

“The Superman Effect” Aral Balkan, DPC11

Separation of layout and content at the content source level

1

Do not compromise on user experience 2

Page 24: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

“The Superman Effect” Aral Balkan, DPC11

“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

Separation of layout and content at the content source level

1

Do not compromise on user experience 2

Page 25: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

“The Superman Effect” Aral Balkan, DPC11

“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

Separation of layout and content at the content source level

1

Do not compromise on user experience 2

Have a single source of content 3

Page 26: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21/05/2011Nicolas Pastorino - DPC11

Pre-requisites to multichannel distribution

7

“The Superman Effect” Aral Balkan, DPC11

“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

Separation of layout and content at the content source level

1

Do not compromise on user experience 2

Have a single source of content 3

“Publishers usually can't afford a dedicated editorial team per channel”

Page 27: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 28: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Ready to tackle

your channels

yet ?

Page 29: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Ready to tackle

your channels

yet ?

We’re hardly off the ground. Let’s dig further...

Page 30: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Page 31: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Page 32: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Monetized Content Streams

Page 33: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Page 34: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Push ContentNewsletters

3rd partyCRM, ERP

Page 35: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Push ContentNewsletters

PrintLegacy publication chains

3rd partyCRM, ERP

Page 36: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Push ContentNewsletters

PrintLegacy publication chains

Social Media

3rd partyCRM, ERP

Page 37: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 38: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

"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."

Page 39: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 40: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Having a REST ?

:)

Page 41: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Having a REST ?

:)

A touch more of

insight will help...

Page 42: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 43: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

“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.”

Page 44: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 45: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Least Common

Denominator :

Page 46: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Least Common

Denominator :

a REST API

Page 47: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 48: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 49: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Those were the basics to increase

your REACHthrough multiple

channels

Page 50: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Those were the basics to increase

your REACHthrough multiple

channels Right Chris ?

Page 51: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

REST

15

Page 52: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

REpresentational State Transfer

Page 53: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

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

Page 54: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

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://en.wikipedia.org/wiki/Representa4onal_State_Transferh"p://www.infoq.com/ar4cles/rest-­‐introduc4on

Page 55: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

REpresentational State Transfer

h"p://en.wikipedia.org/wiki/Representa4onal_State_Transferh"p://www.infoq.com/ar4cles/rest-­‐introduc4on

Page 57: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Extensible REST API

18

at the core of the eZ Publish CMS

Page 58: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

At the core of the eZ Publish CMS

REST as a core feature

19

Extensible REST API

Page 59: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Dedicated front-controller

20

At the core of the eZ Publish CMS Extensible REST API

Page 60: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 21

REST setup

REST

FC

eZPREST  request

eZ  Publishweb-­‐request

At the core of the eZ Publish CMS Extensible REST API

Page 61: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 21

REST setup

REST

FC

eZPREST  request

eZ  Publishweb-­‐request

At the core of the eZ Publish CMS Extensible REST API

Page 62: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 22

Mapping content into resources

At the core of the eZ Publish CMS Extensible REST API

Page 63: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 23

Makes data availableMakes data available

At the core of the eZ Publish CMS Extensible REST API

Page 64: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 23

Makes data reusableMakes data reusable

At the core of the eZ Publish CMS Extensible REST API

Page 65: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 24

Content is essentially liberated

At the core of the eZ Publish CMS Extensible REST API

Page 66: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

URI pattern

25

At the core of the eZ Publish CMS Extensible REST API

Page 67: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix Provider VersionGET Host / / / / Call + params

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 68: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix Provider Version

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 69: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix

Provider Version

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 70: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix

Provider Version

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 71: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix

Provider

Version

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 72: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix

Provider

Version

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 73: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 26

Prefix

Provider

Version

Just a token to trigger your rewrite rule

ezpRestPrefixFilterInterface

At the core of the eZ Publish CMS Extensible REST API

Page 74: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Prefix filter

27

Current provider

Current parsed version value

ezpRestPrefixFilterInterface

Page 75: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Versioned API

28

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 ); }}

Page 76: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Versioned API

makes the notion version a part of the routing decision

29

Version

ezpRestVersionedRoute

Page 77: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Extending the interface

30

At the core of the eZ Publish CMS Extensible REST API

Page 78: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Extending the interface

31

REST providers

Page 79: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Extending the interface

ezpRestProviderInterface

32

Page 80: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Overview of hooks

33

Page 81: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11 34

Page 82: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Route setup - Example

35

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 ) ); }}

Page 83: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Extensible REST API

36

Key features

Page 84: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Content resources

37

Key featuresExtensible REST API

Page 85: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Key features

GET /[api]/v1/content/object/<objectId>/fields HTTP/1.1

38

Page 86: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

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)

39

Page 87: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

21.05.2011Nicolas Pastorino - DPC11

Key features

GET /[api]/v1/content/object/<objectId>/field/

<FieldIdentifier> HTTP/1.1

40

Page 88: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Demo

41

Web + Android, eZ Publish powered

Page 89: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Famous Last Slides

42

Page 90: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

Multichannel : why ?REST

Extensible REST APIDemo

RECAP

Page 91: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Page 92: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

You won’t ever play Pacman the same way again :)

Page 93: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

You won’t ever play Pacman the same way again :)

Page 94: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

You won’t ever play Pacman the same way again :)

Page 95: Nicolas Pastorino - Launching content in mobility with REST & eZ Publish

eZ Communityhttp://share.ez.no

eZ Publish Community Projecthttp://share.ez.no/download & http://share.ez.no/get-involved

eZ Systems & eZ Publish Enterprise Editionhttp://ez.no

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, Tobias Schlitt Get a 20% off coupon at the eZ Booth in the hall, and register : http://london2011.ez.no

Thank you !