SlideShare une entreprise Scribd logo
1  sur  60
Télécharger pour lire hors ligne
#REST #ezpublish #symfony #IPC13 #CMS #SOA #UX

A REST Layer on Top
of The World
Nicolas Pastorino | eZ Systems
VP Community & Online Marketing
@jeanvoye | nicolas.pastorino@ez.no
Contents: Courtesy of Damien Pobel
about:eZ
about:eZ
Enterprise Open-source since 1999
Creators of eZ Publish Platform
Global
Business: http://ez.no | Community: http://share.ez.no
about:eZ
Enterprise Open-source since 1999
Creators of eZ Publish Platform
Global
Business: http://ez.no | Community: http://share.ez.no
@eZSystems
http://google.com/+ezsystems
http://linkedin.com/company/16738
https://github.com/ezsystems
about:me
about:me
eZ Publish Community since 2005
Lead Community + Marketing at eZ
Content Management, Open-source, Mountaineering
about:me
eZ Publish Community since 2005
Lead Community + Marketing at eZ
Content Management, Open-source, Mountaineering

@jeanvoye
http://bit.ly/nicolas-on-gplus
http://fr.linkedin.com/in/nicolaspastorino/
https://github.com/nfrp
T

O

D

A

Y
Y

REST

A

eZ Publish

D

REST in eZ Publish

O

DEMO

T

REST for UX
REST

5
REST?

h"p://www.infoq.com/ar4cles/rest-­‐introduc4on
h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
REST?
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
REST? (ctd)

h"p://www.infoq.com/ar4cles/rest-­‐introduc4on
h"p://en.wikipedia.org/wiki/Representa4onal_State_Transfer
REST? (ctd)
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
HTTP 1.1 Request - Anatomy
HTTP 1.1 Request - Anatomy
• HTTP verb / method : GET,POST,PUT,DELETE,
TRACE,OPTIONS,HEAD, ...
HTTP 1.1 Request - Anatomy
• HTTP verb / method : GET,POST,PUT,DELETE,
TRACE,OPTIONS,HEAD, ...

• ... or a custom verb: PATCH,COPY, ...
HTTP 1.1 Request - Anatomy
• HTTP verb / method : GET,POST,PUT,DELETE,
TRACE,OPTIONS,HEAD, ...

• ... or a custom verb: PATCH,COPY, ...
• Set of headers
HTTP 1.1 Request - Anatomy
• HTTP verb / method : GET,POST,PUT,DELETE,
TRACE,OPTIONS,HEAD, ...

• ... or a custom verb: PATCH,COPY, ...
• Set of headers
• A body in POST,PUT or custom verb requests
HTTP 1.1 Response - Anatomy
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
• 2XX: here you go
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
• 2XX: here you go
• 3XX: go away
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
• 2XX: here you go
• 3XX: go away
• 4XX: you f * * * * d up
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
• 2XX: here you go
• 3XX: go away
• 4XX: you f * * * * d up
• 5XX: I f * * * * d up
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
• 2XX: here you go
• 3XX: go away
• 4XX: you f * * * * d up
• 5XX: I f * * * * d up
• Set of headers
HTTP 1.1 Response - Anatomy
• Status code (by @stevelosh)
• 1XX: hold on
• 2XX: here you go
• 3XX: go away
• 4XX: you f * * * * d up
• 5XX: I f * * * * d up
• Set of headers
• A body depending on the response
eZ Publish

10
Standard
Symfony2 App.
(=app)
Standard
Symfony2 App.
(=app)

+

eZ Publish
bundles
(PHP & REST APIs
+ Legacy)

vendor/
ezsystems/
ezpublish-kernel
Standard
Symfony2 App.
(=app)

+

eZ Publish
bundles
(PHP & REST APIs
+ Legacy)

vendor/
ezsystems/
ezpublish-kernel

+

Full-blown
Back-office
THIS is eZ Publish 5
Standard
Symfony2 App.
(=app)

+

eZ Publish
bundles
(PHP & REST APIs
+ Legacy)

vendor/
ezsystems/
ezpublish-kernel

+

Full-blown
Back-office
REST in eZ Publish

12
REST API in eZ Publish

4.x
REST API in eZ Publish

• eZ Publish 4.x has a REST API
• Prefix /ezp/api/v1/
• Read only
• Very limited scope / incomplete

4.x
REST API in eZ Publish

5.x
REST API in eZ Publish

5.x
REST API in eZ Publish
•
•
•

Read / Write

•
•
•
•

5.x

Support Basic Auth and Session Auth

Prefix /ezp/api/v2/
Allows to handle almost everything in the repository
(Content, Location, Types, ...)
XML or JSON support in input and output
Hypermedia as the Engine of Application State (HATEOAS)
Specifications: http://j.mp/ezpublish-rest-spec
A REST Layer on top of
a world of Content
A REST Layer on top of
a world of Content
A REST Layer on top of
a world of Content

o/
DEMO

16
Demo Synopsis
•
•
•

Navigate to http://cp2013.9.loc/ then to http://cp2013.9.loc/Blog
Add Blog post from http://cp2013.9.loc/ezdemo_site_admin/Blog (Content: http://phpconference.com/2013/en/sessions/rest-layer-top-world )
REST: Request REST Root:

•
•
•

Explain all parameters, then run.

REST: Show children of Content root

•
•

chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/1

chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/2

REST: Show Location/Content/ContentInfo for one child (“Blog”)

•
•
•
•

chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/3

chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/5

REST: Show children of one child (“Blog”)

•
•
•
•

chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/4
Edit Content, then reload.

Show children: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/8
Delete the previously created blog post: curl -u "admin:publish" -X DELETE http://cp2013.9.loc/api/ezp/v2/content/objects/<objectId>
Refresh children list: Show children: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/8

REST: Create an Image object

•
•

Show ContentType (ContentClass) in back-office: http://cp2013.9.loc/ezdemo_site_admin/class/view/27
Create image from command line

•
•

$> cdipc13

•
•

Publish object: curl -u "admin:publish" -X PUBLISH http://cp2013.9.loc/api/ezp/v2/content/objects/<object Id>/versions/1

$> curl -u "admin:publish" -i -H "Accept: application/json" -H "Content-Type: application/vnd.ez.api.ContentCreate+json" -X POST -d
@createimage.json http://cp2013.9.loc/api/ezp/v2/content/objects
Show image in the back-office: http://cp2013.9.loc/ezdemo_site_admin/eZ-Systems-logo-created-with-the-REST-API
REST for UX

18
REST API for more than
service-to-service: UX example
REST API for more than
service-to-service: UX example
• API REST as provider for ajax calls - data
• Initial page load (JS code, generating an
interface) - then Ajax+REST for navigation, data
retrieval,

• Total separation of functional UX and data
retrieval + back-end business logic.
REST API for more than
service-to-service: UX example
REST API for more than
service-to-service: UX example
• Tools
• JS lib, REST client: https://github.com/
ezsystems/ez-js-rest-client

• Reproduction of the public PHP API: exposing
services

• Relying on HATEOS, but simplifying usage of it
REST API for more than
service-to-service: UX example
REST API for more than
service-to-service: UX example
• Why?
• Easy to discover the REST API structure from a client
• BC support: no URL hard-coding, painless clientside, all existing projects relying on the API need not
be modified,

• Simplifies cache management (HTTP): easy to know
exactly which resource is to be expired after a
change in content repository.
Demo Synopsis
•
•
•
•

Navigate to http://cp2013.9.loc/summercamp/rest-test
Open Console > Network > Filter with “XHR” only
Reload page, and clear console
Click on “Details” for “Blog”

•

Inspect request in console:

•
•
•
•

show URL

In “Preview” subtab: show response, focus on “Content.Section”
--> Show next request (back to “Headers” subtab): Section

•
•
•
•

show”Accept” header value,

show”Accept” header value,
show URL
In “Preview” subtab: show response, focus on “Section.name”

--> Show next request (back to “Headers” subtab): Owner
Wrap-up

24
T

O

D

A

Y
Y

REST

A

eZ Publish

D

REST in eZ Publish

O

DEMO

T

REST for UX
Slides available soon at
http://slideshare.net/jeanvoye

@jeanvoye
http://bit.ly/nicolas-on-gplus
http://fr.linkedin.com/in/nicolaspastorino/
https://github.com/nfrp

eZ Publish Community http://share.ez.no
eZ Publish 5 Community Project
http://share.ez.no/download
https://github.com/ezsystems/ezpublish-community
eZ Systems & eZ Publish Platform Enterprise Edition
http://ez.no

Contenu connexe

Similaire à A REST Layer on Top of The World

JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainKen Collins
 
Using eZ Platform in an API Era
Using eZ Platform in an API EraUsing eZ Platform in an API Era
Using eZ Platform in an API EraeZ Systems
 
Atmosphere 2014: Let's build a solid base for a scale. - Krzysztof Debski
Atmosphere 2014: Let's build a solid base for a scale. - Krzysztof DebskiAtmosphere 2014: Let's build a solid base for a scale. - Krzysztof Debski
Atmosphere 2014: Let's build a solid base for a scale. - Krzysztof DebskiPROIDEA
 
Designing a beautiful REST json api
Designing a beautiful REST json apiDesigning a beautiful REST json api
Designing a beautiful REST json api0x07de
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swaggerTony Tam
 
Beyond 'Set it and Forget it': Proactively managing your EZproxy server
Beyond 'Set it and Forget it': Proactively managing your EZproxy serverBeyond 'Set it and Forget it': Proactively managing your EZproxy server
Beyond 'Set it and Forget it': Proactively managing your EZproxy serverNASIG
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
AtmosphereConf - Let's build a solid base for a scale
AtmosphereConf - Let's build a solid base for a scaleAtmosphereConf - Let's build a solid base for a scale
AtmosphereConf - Let's build a solid base for a scaleKrzysztof Debski
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redisErhwen Kuo
 
Kubernetes and AWS Lambda can play nicely together
Kubernetes and AWS Lambda can play nicely togetherKubernetes and AWS Lambda can play nicely together
Kubernetes and AWS Lambda can play nicely togetherEdward Wilde
 
Unleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ PlatformUnleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ PlatformSébastien Morel
 
Server Side Swift
Server Side SwiftServer Side Swift
Server Side SwiftChad Moone
 
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0Martijn Dashorst
 
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)Balazs Bucsay
 
Introduction to NodeJS with LOLCats
Introduction to NodeJS with LOLCatsIntroduction to NodeJS with LOLCats
Introduction to NodeJS with LOLCatsDerek Anderson
 

Similaire à A REST Layer on Top of The World (20)

JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own Domain
 
Using eZ Platform in an API Era
Using eZ Platform in an API EraUsing eZ Platform in an API Era
Using eZ Platform in an API Era
 
Atmosphere 2014: Let's build a solid base for a scale. - Krzysztof Debski
Atmosphere 2014: Let's build a solid base for a scale. - Krzysztof DebskiAtmosphere 2014: Let's build a solid base for a scale. - Krzysztof Debski
Atmosphere 2014: Let's build a solid base for a scale. - Krzysztof Debski
 
Designing a beautiful REST json api
Designing a beautiful REST json apiDesigning a beautiful REST json api
Designing a beautiful REST json api
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Beyond 'Set it and Forget it': Proactively managing your EZproxy server
Beyond 'Set it and Forget it': Proactively managing your EZproxy serverBeyond 'Set it and Forget it': Proactively managing your EZproxy server
Beyond 'Set it and Forget it': Proactively managing your EZproxy server
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
AtmosphereConf - Let's build a solid base for a scale
AtmosphereConf - Let's build a solid base for a scaleAtmosphereConf - Let's build a solid base for a scale
AtmosphereConf - Let's build a solid base for a scale
 
Mastering composer
Mastering composerMastering composer
Mastering composer
 
UCLA HACKU'11
UCLA HACKU'11UCLA HACKU'11
UCLA HACKU'11
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
 
NullMQ @ PDX
NullMQ @ PDXNullMQ @ PDX
NullMQ @ PDX
 
Kubernetes and AWS Lambda can play nicely together
Kubernetes and AWS Lambda can play nicely togetherKubernetes and AWS Lambda can play nicely together
Kubernetes and AWS Lambda can play nicely together
 
Unleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ PlatformUnleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ Platform
 
Server Side Swift
Server Side SwiftServer Side Swift
Server Side Swift
 
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
 
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
 
Introduction to NodeJS with LOLCats
Introduction to NodeJS with LOLCatsIntroduction to NodeJS with LOLCats
Introduction to NodeJS with LOLCats
 

Plus de Nicolas Pastorino

Symfony et eZ Publish: embarquement immédiat - talk at Symfony Live Paris
Symfony et eZ Publish: embarquement immédiat - talk at Symfony Live ParisSymfony et eZ Publish: embarquement immédiat - talk at Symfony Live Paris
Symfony et eZ Publish: embarquement immédiat - talk at Symfony Live ParisNicolas Pastorino
 
Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...
Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...
Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...Nicolas Pastorino
 
Nicolas Pastorino - The Open-source roar in the eZ Community
Nicolas Pastorino - The Open-source roar in the eZ CommunityNicolas Pastorino - The Open-source roar in the eZ Community
Nicolas Pastorino - The Open-source roar in the eZ CommunityNicolas Pastorino
 
Nicolas Pastorino - REST + recommendation, consume the right content, anywher...
Nicolas Pastorino - REST + recommendation, consume the right content, anywher...Nicolas Pastorino - REST + recommendation, consume the right content, anywher...
Nicolas Pastorino - REST + recommendation, consume the right content, anywher...Nicolas Pastorino
 
Nicolas Pastorino - eZ Community - Innovation and Open-source inside
Nicolas Pastorino - eZ Community - Innovation and Open-source insideNicolas Pastorino - eZ Community - Innovation and Open-source inside
Nicolas Pastorino - eZ Community - Innovation and Open-source insideNicolas Pastorino
 
IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ PublishIPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ PublishNicolas Pastorino
 
Nicolas Pastorino - Launching Content in mobility with REST and eZ Publish
Nicolas Pastorino - Launching Content in mobility with REST and eZ PublishNicolas Pastorino - Launching Content in mobility with REST and eZ Publish
Nicolas Pastorino - Launching Content in mobility with REST and eZ PublishNicolas Pastorino
 
Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Nicolas Pastorino - Launching content in mobility with REST & eZ PublishNicolas Pastorino - Launching content in mobility with REST & eZ Publish
Nicolas Pastorino - Launching content in mobility with REST & eZ PublishNicolas Pastorino
 

Plus de Nicolas Pastorino (8)

Symfony et eZ Publish: embarquement immédiat - talk at Symfony Live Paris
Symfony et eZ Publish: embarquement immédiat - talk at Symfony Live ParisSymfony et eZ Publish: embarquement immédiat - talk at Symfony Live Paris
Symfony et eZ Publish: embarquement immédiat - talk at Symfony Live Paris
 
Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...
Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...
Nicolas Pastorino - Distribution de contenu scalable, le multicanal avec REST...
 
Nicolas Pastorino - The Open-source roar in the eZ Community
Nicolas Pastorino - The Open-source roar in the eZ CommunityNicolas Pastorino - The Open-source roar in the eZ Community
Nicolas Pastorino - The Open-source roar in the eZ Community
 
Nicolas Pastorino - REST + recommendation, consume the right content, anywher...
Nicolas Pastorino - REST + recommendation, consume the right content, anywher...Nicolas Pastorino - REST + recommendation, consume the right content, anywher...
Nicolas Pastorino - REST + recommendation, consume the right content, anywher...
 
Nicolas Pastorino - eZ Community - Innovation and Open-source inside
Nicolas Pastorino - eZ Community - Innovation and Open-source insideNicolas Pastorino - eZ Community - Innovation and Open-source inside
Nicolas Pastorino - eZ Community - Innovation and Open-source inside
 
IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ PublishIPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
IPCse11 Nicolas Pastorino Launching content in mobility with REST and eZ Publish
 
Nicolas Pastorino - Launching Content in mobility with REST and eZ Publish
Nicolas Pastorino - Launching Content in mobility with REST and eZ PublishNicolas Pastorino - Launching Content in mobility with REST and eZ Publish
Nicolas Pastorino - Launching Content in mobility with REST and eZ Publish
 
Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
Nicolas Pastorino - Launching content in mobility with REST & eZ PublishNicolas Pastorino - Launching content in mobility with REST & eZ Publish
Nicolas Pastorino - Launching content in mobility with REST & eZ Publish
 

Dernier

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Dernier (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

A REST Layer on Top of The World

  • 1. #REST #ezpublish #symfony #IPC13 #CMS #SOA #UX A REST Layer on Top of The World Nicolas Pastorino | eZ Systems VP Community & Online Marketing @jeanvoye | nicolas.pastorino@ez.no Contents: Courtesy of Damien Pobel
  • 3. about:eZ Enterprise Open-source since 1999 Creators of eZ Publish Platform Global Business: http://ez.no | Community: http://share.ez.no
  • 4. about:eZ Enterprise Open-source since 1999 Creators of eZ Publish Platform Global Business: http://ez.no | Community: http://share.ez.no @eZSystems http://google.com/+ezsystems http://linkedin.com/company/16738 https://github.com/ezsystems
  • 6. about:me eZ Publish Community since 2005 Lead Community + Marketing at eZ Content Management, Open-source, Mountaineering
  • 7. about:me eZ Publish Community since 2005 Lead Community + Marketing at eZ Content Management, Open-source, Mountaineering @jeanvoye http://bit.ly/nicolas-on-gplus http://fr.linkedin.com/in/nicolaspastorino/ https://github.com/nfrp
  • 9. Y REST A eZ Publish D REST in eZ Publish O DEMO T REST for UX
  • 12. REST? 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
  • 14. REST? (ctd) 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
  • 15. HTTP 1.1 Request - Anatomy
  • 16. HTTP 1.1 Request - Anatomy • HTTP verb / method : GET,POST,PUT,DELETE, TRACE,OPTIONS,HEAD, ...
  • 17. HTTP 1.1 Request - Anatomy • HTTP verb / method : GET,POST,PUT,DELETE, TRACE,OPTIONS,HEAD, ... • ... or a custom verb: PATCH,COPY, ...
  • 18. HTTP 1.1 Request - Anatomy • HTTP verb / method : GET,POST,PUT,DELETE, TRACE,OPTIONS,HEAD, ... • ... or a custom verb: PATCH,COPY, ... • Set of headers
  • 19. HTTP 1.1 Request - Anatomy • HTTP verb / method : GET,POST,PUT,DELETE, TRACE,OPTIONS,HEAD, ... • ... or a custom verb: PATCH,COPY, ... • Set of headers • A body in POST,PUT or custom verb requests
  • 20. HTTP 1.1 Response - Anatomy
  • 21. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh)
  • 22. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on
  • 23. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on • 2XX: here you go
  • 24. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on • 2XX: here you go • 3XX: go away
  • 25. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on • 2XX: here you go • 3XX: go away • 4XX: you f * * * * d up
  • 26. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on • 2XX: here you go • 3XX: go away • 4XX: you f * * * * d up • 5XX: I f * * * * d up
  • 27. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on • 2XX: here you go • 3XX: go away • 4XX: you f * * * * d up • 5XX: I f * * * * d up • Set of headers
  • 28. HTTP 1.1 Response - Anatomy • Status code (by @stevelosh) • 1XX: hold on • 2XX: here you go • 3XX: go away • 4XX: you f * * * * d up • 5XX: I f * * * * d up • Set of headers • A body depending on the response
  • 31. Standard Symfony2 App. (=app) + eZ Publish bundles (PHP & REST APIs + Legacy) vendor/ ezsystems/ ezpublish-kernel
  • 32. Standard Symfony2 App. (=app) + eZ Publish bundles (PHP & REST APIs + Legacy) vendor/ ezsystems/ ezpublish-kernel + Full-blown Back-office
  • 33. THIS is eZ Publish 5 Standard Symfony2 App. (=app) + eZ Publish bundles (PHP & REST APIs + Legacy) vendor/ ezsystems/ ezpublish-kernel + Full-blown Back-office
  • 34. REST in eZ Publish 12
  • 35. REST API in eZ Publish 4.x
  • 36. REST API in eZ Publish • eZ Publish 4.x has a REST API • Prefix /ezp/api/v1/ • Read only • Very limited scope / incomplete 4.x
  • 37. REST API in eZ Publish 5.x
  • 38. REST API in eZ Publish 5.x
  • 39. REST API in eZ Publish • • • Read / Write • • • • 5.x Support Basic Auth and Session Auth Prefix /ezp/api/v2/ Allows to handle almost everything in the repository (Content, Location, Types, ...) XML or JSON support in input and output Hypermedia as the Engine of Application State (HATEOAS) Specifications: http://j.mp/ezpublish-rest-spec
  • 40. A REST Layer on top of a world of Content
  • 41. A REST Layer on top of a world of Content
  • 42. A REST Layer on top of a world of Content o/
  • 44. Demo Synopsis • • • Navigate to http://cp2013.9.loc/ then to http://cp2013.9.loc/Blog Add Blog post from http://cp2013.9.loc/ezdemo_site_admin/Blog (Content: http://phpconference.com/2013/en/sessions/rest-layer-top-world ) REST: Request REST Root: • • • Explain all parameters, then run. REST: Show children of Content root • • chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/1 chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/2 REST: Show Location/Content/ContentInfo for one child (“Blog”) • • • • chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/3 chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/5 REST: Show children of one child (“Blog”) • • • • chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/4 Edit Content, then reload. Show children: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/8 Delete the previously created blog post: curl -u "admin:publish" -X DELETE http://cp2013.9.loc/api/ezp/v2/content/objects/<objectId> Refresh children list: Show children: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html#RequestPlace:projectEndpoint/8 REST: Create an Image object • • Show ContentType (ContentClass) in back-office: http://cp2013.9.loc/ezdemo_site_admin/class/view/27 Create image from command line • • $> cdipc13 • • Publish object: curl -u "admin:publish" -X PUBLISH http://cp2013.9.loc/api/ezp/v2/content/objects/<object Id>/versions/1 $> curl -u "admin:publish" -i -H "Accept: application/json" -H "Content-Type: application/vnd.ez.api.ContentCreate+json" -X POST -d @createimage.json http://cp2013.9.loc/api/ezp/v2/content/objects Show image in the back-office: http://cp2013.9.loc/ezdemo_site_admin/eZ-Systems-logo-created-with-the-REST-API
  • 46. REST API for more than service-to-service: UX example
  • 47. REST API for more than service-to-service: UX example • API REST as provider for ajax calls - data • Initial page load (JS code, generating an interface) - then Ajax+REST for navigation, data retrieval, • Total separation of functional UX and data retrieval + back-end business logic.
  • 48. REST API for more than service-to-service: UX example
  • 49. REST API for more than service-to-service: UX example • Tools • JS lib, REST client: https://github.com/ ezsystems/ez-js-rest-client • Reproduction of the public PHP API: exposing services • Relying on HATEOS, but simplifying usage of it
  • 50. REST API for more than service-to-service: UX example
  • 51. REST API for more than service-to-service: UX example • Why? • Easy to discover the REST API structure from a client • BC support: no URL hard-coding, painless clientside, all existing projects relying on the API need not be modified, • Simplifies cache management (HTTP): easy to know exactly which resource is to be expired after a change in content repository.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56. Demo Synopsis • • • • Navigate to http://cp2013.9.loc/summercamp/rest-test Open Console > Network > Filter with “XHR” only Reload page, and clear console Click on “Details” for “Blog” • Inspect request in console: • • • • show URL In “Preview” subtab: show response, focus on “Content.Section” --> Show next request (back to “Headers” subtab): Section • • • • show”Accept” header value, show”Accept” header value, show URL In “Preview” subtab: show response, focus on “Section.name” --> Show next request (back to “Headers” subtab): Owner
  • 59. Y REST A eZ Publish D REST in eZ Publish O DEMO T REST for UX
  • 60. Slides available soon at http://slideshare.net/jeanvoye @jeanvoye http://bit.ly/nicolas-on-gplus http://fr.linkedin.com/in/nicolaspastorino/ https://github.com/nfrp eZ Publish Community http://share.ez.no eZ Publish 5 Community Project http://share.ez.no/download https://github.com/ezsystems/ezpublish-community eZ Systems & eZ Publish Platform Enterprise Edition http://ez.no