Top Banner
Launching content in mobility with REST & eZ Publish
90

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

Nov 01, 2014

Download

Technology

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.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Launching content in mobility withREST & eZ Publish

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

Launching content in mobility withREST & eZ Publish

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

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

Mobile

Launching content in mobility withREST & eZ Publish

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

International PHP Conference, SE 2011 - Berlin - May 30th

#ipcse11

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

Mobile

Launching content in mobility withREST & eZ Publish

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

International PHP Conference, SE 2011 - Berlin - May 30th

#ipcse11

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

Our agenda :

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

Multichannel : why ?Our agenda :

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

Multichannel : why ?REST

Our agenda :

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

Multichannel : why ?REST

Extensible REST API

Our agenda :

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

Multichannel : why ?REST

Extensible REST APIDemo

Our agenda :

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

Multichannel : why ?

3

Page 11: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 12: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

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

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

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

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

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

Boring,right ?

Page 15: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 16: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Multichannel content distribution is the real Pacman

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

Multichannel content distribution is the real Pacman

Page 18: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 19: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

Pre-requisites to multichannel distribution

7

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

30/05/2011Nicolas Pastorino - IPCse11

Pre-requisites to multichannel distribution

7

Separation of layout and content at the content source level

1

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

30/05/2011Nicolas Pastorino - IPCse11

Pre-requisites to multichannel distribution

7

Separation of layout and content at the content source level

1

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

30/05/2011Nicolas Pastorino - IPCse11

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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 28: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Are 3 rules of thumb

enough ?

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

Are 3 rules of thumb

enough ? We’re

hardly off the ground.

Let’s dig further...

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

CMSSingle Content Source /

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

CMSSingle Content Source /

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

CMSSingle Content Source /

Monetized Content Streams

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

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

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

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Push ContentNewsletters

3rd partyCRM, ERP

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

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Push ContentNewsletters

PrintLegacy publication chains

3rd partyCRM, ERP

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

CMSSingle Content Source /

Monetized Content Streams

Mobile ApplicationsSmartphones, Tablets

Push ContentNewsletters

PrintLegacy publication chains

Social Media

3rd partyCRM, ERP

Page 37: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 38: IPCse11 Nicolas Pastorino Launching content in mobility with REST and 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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 40: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Having a REST ?

:)

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

Having a REST ?

:)

A touch more of

insight will help...

Page 42: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 43: IPCse11 Nicolas Pastorino Launching content in mobility with REST and 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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 45: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Least Common

Denominator :

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

Least Common

Denominator :

a REST API

Page 47: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 48: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Those were the basics to increase

your REACHthrough multiple

channels

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

REST

15

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

REpresentational State Transfer

Page 51: IPCse11 Nicolas Pastorino Launching content in mobility with REST and 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 (“HATEOAS”)• Use standard methods• Resources with multiple representations• Communicate statelessly

Page 52: IPCse11 Nicolas Pastorino Launching content in mobility with REST and 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 (“HATEOAS”)• 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 53: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

REpresentational State Transfer

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

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

Extensible REST API

18

at the core of the eZ Publish CMS

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

30/05/2011Nicolas Pastorino - IPCse11

At the core of the eZ Publish CMS

REST as a core feature

19

Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11

Dedicated front-controller

20

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 21

REST setup

REST

FC

eZPREST  request

eZ  Publishweb-­‐request

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 21

REST setup

REST

FC

eZPREST  request

eZ  Publishweb-­‐request

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 22

Mapping content into resources

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 23

Makes data availableMakes data available

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 23

Makes data reusableMakes data reusable

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 24

Content is essentially liberated

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11

URI pattern

25

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11 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 66: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11 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 67: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11 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 68: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11 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: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

Prefix filter

27

Current provider

Current parsed version value

ezpRestPrefixFilterInterface

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

30/05/2011Nicolas Pastorino - IPCse11

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 71: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

Versioned API

makes the notion version a part of the routing decision

29

Version

ezpRestVersionedRoute

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

30/05/2011Nicolas Pastorino - IPCse11

Build your own flavor,extend the interface(s)

30

At the core of the eZ Publish CMS Extensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11

Extending the interface

31

REST providers

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

30/05/2011Nicolas Pastorino - IPCse11

Extending the interface

ezpRestProviderInterface

32

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

Overview of hooksthe places where you can go wild.

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

30/05/2011Nicolas Pastorino - IPCse11 34

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

30/05/2011Nicolas Pastorino - IPCse11

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 78: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

Extensible REST API

36

Key features

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

30/05/2011Nicolas Pastorino - IPCse11

Content resources

37

Key featuresExtensible REST API

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

30/05/2011Nicolas Pastorino - IPCse11

Key features

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

38

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

30/05/2011Nicolas Pastorino - IPCse11

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 82: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

30/05/2011Nicolas Pastorino - IPCse11

Key features

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

<FieldIdentifier> HTTP/1.1

40

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

Demo

41

Web + Android, eZ Publish powered

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

Famous Last Slides

42

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

Multichannel : why ?REST

Extensible REST APIDemo

RECAP

Page 86: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
Page 87: IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish

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

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

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

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

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

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

eZ Communityhttp://share.ez.no

eZ Publish Community Projecthttps://github.com/ezsystems/ezpublishhttp://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/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

Thank you !