ez goes mobile - the restful way

9
Markus Birth eZ goes mobile ...the RESTful way

Upload: markus-birth

Post on 14-Jul-2015

1.565 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: eZ goes mobile - the RESTful way

Markus Birth

eZ goes mobile

...the RESTful way

Page 2: eZ goes mobile - the RESTful way

Slide 2 / Markus Birth

About me

Markus Birth

Software-Developer at silver.solutions GmbH

Berlin, Germany

silver.solutions offers great experience in connecting eZ Publish to ERP systems (Navision, Axapta, SAP R/3). We also do mobile apps.

I do mostly backend programming for eZ Publish sites where I'm specialized in interfaces. My second field of activity is mobile apps.

Page 3: eZ goes mobile - the RESTful way

Slide 3

REST

→ Representational State Transfer

(Google it! Or try Wikipedia: http://en.wikipedia.org/wiki/REST)

Page 4: eZ goes mobile - the RESTful way

Image from pixelio.de Slide 4

Things you might need

What you need:eZ 4.5 with ezpRestApiProviderconfigured OAuth2 consumer credentialsuser login with appropriate access rightsdoc.ez.nosome client (e.g. a mobile app)

Page 5: eZ goes mobile - the RESTful way

Slide 5 / Markus Birth

I am who I am (or: OAuth 2.0)

to communicate via REST, a valid access_token is required

can be retrieved via OAuth2 workflow

tricky for non-browser applications2 ways for apps on mobile devices:

a) show login window in an own WebView and watch the currently shown URL for the endpoint URI

b) register a new protocol handler, set the endpoint_uri and react on that (works from any mobile browser)

e.g. mycrapp://

Page 6: eZ goes mobile - the RESTful way

Slide 6 / Markus Birth

OAuth 2.0 login

Page 7: eZ goes mobile - the RESTful way

Slide 7 / Markus Birth

eZ REST URL Scheme

Methods: GET, POST, PUT, DELETE

Base URL: http://myezsite.com/api/ezp/v1/content/object/[objectID]/content/node/[nodeID]/content/(node|object)/[ID]/fields/content/(node|object)/[ID]/field/[fieldID]/content/node/[nodeID]/list/offset/…/limit/…/sort/…/…/content/node/[nodeID]/childrenCount

non-default language: http://…?translation=xxx-YY

Page 8: eZ goes mobile - the RESTful way

Slide 8 / Markus Birth

The first request

GET /api/ezp/v1/content/node/2/listAuthorization: OAuth 0123456789abcdef…Accept: application/json

"childrenNodes": [ { "objectName": "Awards", "classIdentifier": "subcategory", "datePublished": 1302091069, "dateModified": 1307614988, "objectRemoteId": "d003…3e94", "objectId": 1203, "nodeId": 1257, "nodeRemoteId": "f4ef…47f2", "fullUrl": "http:\/\/…\/Awards", "link": "http:\/\/…\/content\/node\/1257" }, { … } ],

Page 9: eZ goes mobile - the RESTful way

Slide 9 / Markus Birth

Thank you for listening

http://lanyrd.com/sfhtw