SlideShare a Scribd company logo
1 of 21
REST API V2
Agenda
Agenda
First things first



1. What is REST

2. eZ publish 5, REST API v2

3. Client API

4. REST server API

5. Examples & practice
What is REST ?
What is REST


REST = REpresentational State Transfer

Idempotent
  GET will NEVER change data

Uses HTTP verbs
 Well known ones: GET, POST
 More discrete ones: PUT, DELETE
 Exotic one: PATCH. But it has an RFC. I swear.

Safe
 GET is safe
 PUT, DELETE are not (especially DELETE). POST usually is not.

CRUD support
 Create, Retrieve, Update, Delete
eZ publish 5 REST API
eZ Publish 5 REST API
Architecture
eZ Publish 5 REST API
Implementation choices



Our REST API provides resources

The same resource has different uses depending on the VERB
  GET /content/objects : lists objects
  POST /content/objects: creates a new object
  DELETE /content/objects/x: deletes object X
  PATCH /content/objects/x: modifies object X

We chose not to implement TONS of resources. KISS.
  Easier maintenance, usage
  Allows us to keep elements unique. Makes HTTP caching possible

API exceptions are always converted to HTTP errors
  NotFoundException: 404
  UnauthorizedException: 401
  RuntimeException: 500...
eZ Publish 5 REST API
Authentication



Authentication will be native
  OAuth 2
  Basic
  SSL client certificate

Authentication has a direct impact on the results
  Each authenticated (or anonymous) user may get different results
  This is of course based on the eZ Publish users, roles & policies
eZ Publish 5 REST API
Client / Server communication flow
Client API
Client SDK
Developer first



We had two choices : fat server, or fat client.
   We went with the fat client

The server is as simple as possible

Complexity lies in the client SDK, which we do provide
  At least a PHP client SDK
  Maybe a Javascript SDK. Feel like doing a pull request ? ;-)
  In an ideal world, Android, iOS...

The client SDK mirrors the Public API
  Public API services, with methods
  Value Objects
  Create & Update structs

The SAME code can be transparently executed locally or remotely !
Server API
Server REST API
Resources, verbs and resource links



The REST API is a thin one

The amount of resources is purposefully limited

Most resources can be requested with different verbs
  Each verb will have a different action
  each action requires a different Request


The root resource (/) will list the available root resources
  This makes the API self-aware
  It makes evolution easier, by limit the hard coding in client implementations
Server SDK
Accept headers



Resources Responses also depend on the Accept Request header

  Example on GET /content/objects/1

  Accept: application/vnd.ez.api.Content
    To request a full content, including current version

  Accept: application/vnd.ez.api.ContentInfo
    To request a content info, without current version

The Response format also depends on the Accept header

  Accept: application/vnd.ez.api.Content+xml
    To request an XML Response

  Accept: application/vnd.ez.api.Content+json
    To request a JSON Response
Server SDK
Request example



Request
GET / HTTP/1.1
Host: api.example.net
Accept: application/vnd.ez.api.Root+xml



Response
HTTP/1.1 200 OK
Content-Type: application/vnd.ez.api.Root+xml
Content-Length: xxx
<?xml version="1.0" encoding="UTF-8"?>
<Root>
  <content href="/content/objects" media-type="application/vnd.ez.api.ContentInfoList+xml"/>
  <contentTypes href="/content/types" media-type="application/vnd.ez.api.ContentTypeInfoList+xml"/>
  <users href="/user/users" media-type="application/vnd.ez.api.UserRefList+xml"/>
  <roles href="/user/roles" media-type="application/vnd.ez.api.RoleList+xml"/>
  <rootLocation href="/content/locations/1" media-type="application/vnd.ez.api.Location+xml"/>
  <rootUserGroup href="/user/groups/1/3" media-type="application/vnd.ez.api.UserGroup+xml"/>
  <rootMediaFolder href="/content/locations/1/43" media-type="application/vnd.ez.api.Location+xml"/>
  <trash href="/content/trash" media-type="application/vnd.ez.api.LocationList+xml"/>
  <sections href="/content/sections" media-type="application/vnd.ez.api.SectionList+xml"/>
  <views href="/content/views" media-type="application/vnd.ez.api.RefList+xml"/>
</Root>
Server SDK
HATEOAS



Hypermedia As The Engine Of Application State

A « perfect » REST API should be self sufficient

Consumers should be able to crawl the API without knowing the
structure

The root resource lists further resources
  content list, section list, users, etc

Further resources should ultimately provide more links

Not done yet, but heavily considered
Examples !
Practice time
Practice time
Setup

cd /var/www/ezp-next
git fetch
git stash
git checkout ezsc

git clone git://gist.github.com/3658045.git examples
cd examples/
The end




                                        ?
Documentation, specs:
http://github.com/ezsystems/ezp-next/tree/master/doc/specifications/rest/

Contact

Twitter: @bdunogier
Google+: Bertrand Dunogier
SlideShare: BertrandDunogier

More Related Content

What's hot

RESTFul Web Services - Intro
RESTFul Web Services - IntroRESTFul Web Services - Intro
RESTFul Web Services - IntroManuel Correa
 
Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)Postman
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsTessa Mero
 
Understanding and testing restful web services
Understanding and testing restful web servicesUnderstanding and testing restful web services
Understanding and testing restful web servicesmwinteringham
 
Web API authentication and authorization
Web API authentication and authorization Web API authentication and authorization
Web API authentication and authorization Chalermpon Areepong
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTBruno Kessler Foundation
 
EDB to PST Converter
EDB to PST ConverterEDB to PST Converter
EDB to PST ConverterSysIn Spire
 
SCWCD 1. get post - url (cap1 - cap2 )
SCWCD 1. get   post - url (cap1 - cap2 )SCWCD 1. get   post - url (cap1 - cap2 )
SCWCD 1. get post - url (cap1 - cap2 )Francesco Ierna
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 SlidesSuraj Gupta
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practicesAnkita Mahajan
 
Create a fake REST API without writing a single line of code
Create a fake REST API without writing a single line of codeCreate a fake REST API without writing a single line of code
Create a fake REST API without writing a single line of codeYashobanta Bai
 
From Open Source to Open API with Restlet
From Open Source to Open API with RestletFrom Open Source to Open API with Restlet
From Open Source to Open API with RestletRestlet
 
Test automation of ap is using postman
Test automation of ap is using postmanTest automation of ap is using postman
Test automation of ap is using postmanBugRaptors
 

What's hot (19)

RESTFul Web Services - Intro
RESTFul Web Services - IntroRESTFul Web Services - Intro
RESTFul Web Services - Intro
 
Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
Understanding and testing restful web services
Understanding and testing restful web servicesUnderstanding and testing restful web services
Understanding and testing restful web services
 
Web API authentication and authorization
Web API authentication and authorization Web API authentication and authorization
Web API authentication and authorization
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReST
 
WordPress REST API
WordPress REST APIWordPress REST API
WordPress REST API
 
EDB to PST Converter
EDB to PST ConverterEDB to PST Converter
EDB to PST Converter
 
SCWCD 1. get post - url (cap1 - cap2 )
SCWCD 1. get   post - url (cap1 - cap2 )SCWCD 1. get   post - url (cap1 - cap2 )
SCWCD 1. get post - url (cap1 - cap2 )
 
CakePHP REST Plugin
CakePHP REST PluginCakePHP REST Plugin
CakePHP REST Plugin
 
REST, RESTful API
REST, RESTful APIREST, RESTful API
REST, RESTful API
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
 
Day03 api
Day03   apiDay03   api
Day03 api
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
Create a fake REST API without writing a single line of code
Create a fake REST API without writing a single line of codeCreate a fake REST API without writing a single line of code
Create a fake REST API without writing a single line of code
 
From Open Source to Open API with Restlet
From Open Source to Open API with RestletFrom Open Source to Open API with Restlet
From Open Source to Open API with Restlet
 
Test automation of ap is using postman
Test automation of ap is using postmanTest automation of ap is using postman
Test automation of ap is using postman
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 

Viewers also liked

eZ Publish Norwegian Public User Group
eZ Publish Norwegian Public User GroupeZ Publish Norwegian Public User Group
eZ Publish Norwegian Public User GroupRoland Benedetti
 
Mobile Channels in eZ Publish
Mobile Channels in eZ PublishMobile Channels in eZ Publish
Mobile Channels in eZ Publishlserwatka
 
Tru club advisor_toolkit_cg_edits_sept101
Tru club advisor_toolkit_cg_edits_sept101Tru club advisor_toolkit_cg_edits_sept101
Tru club advisor_toolkit_cg_edits_sept101Terry Quinn
 
How can agencies engage volunteers in supporting a more included life in the...
How can agencies engage volunteers in supporting a more included  life in the...How can agencies engage volunteers in supporting a more included  life in the...
How can agencies engage volunteers in supporting a more included life in the...LiveWorkPlay
 
TGI's February 2011 letter to OIP
TGI's February 2011 letter to OIPTGI's February 2011 letter to OIP
TGI's February 2011 letter to OIPHonolulu Civil Beat
 
Tn.upi.edu pdf production_and_operations_management
Tn.upi.edu pdf production_and_operations_managementTn.upi.edu pdf production_and_operations_management
Tn.upi.edu pdf production_and_operations_managementDurga Jagannathan
 
Daftar produk halal september 2011
Daftar produk halal september 2011Daftar produk halal september 2011
Daftar produk halal september 2011Bung2
 
Accenture Spend Trends Report Q2 2014
Accenture Spend Trends Report Q2 2014Accenture Spend Trends Report Q2 2014
Accenture Spend Trends Report Q2 2014accenture
 
INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"
INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"
INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"ESADE
 
Loss mechanisms in Polymer-Fullerene Solar Cells
Loss mechanisms in Polymer-Fullerene Solar CellsLoss mechanisms in Polymer-Fullerene Solar Cells
Loss mechanisms in Polymer-Fullerene Solar Cellsdisorderedmatter
 
How to set up an online community?
How to set up an online community?How to set up an online community?
How to set up an online community?Atle Skjekkeland
 
Republic of Tatarstan: General Overview, State System, Economy
Republic of Tatarstan: General Overview, State System, EconomyRepublic of Tatarstan: General Overview, State System, Economy
Republic of Tatarstan: General Overview, State System, EconomyDerrick Staten
 
Mad list of filetypes
Mad list of filetypesMad list of filetypes
Mad list of filetypesAaron Lintz
 
'Reggae On The Internet: Volume 1'
'Reggae On The Internet: Volume 1''Reggae On The Internet: Volume 1'
'Reggae On The Internet: Volume 1'Grant Goddard
 
4000 auto approve wordpress blogs backlink list (pr8-pr1)
4000 auto approve wordpress blogs backlink list (pr8-pr1)4000 auto approve wordpress blogs backlink list (pr8-pr1)
4000 auto approve wordpress blogs backlink list (pr8-pr1)Djuwarsjah Linnus
 
Born Digital - GSE Research presentation
Born Digital - GSE Research presentationBorn Digital - GSE Research presentation
Born Digital - GSE Research presentationPublishing Technology
 

Viewers also liked (20)

eZ Publish Norwegian Public User Group
eZ Publish Norwegian Public User GroupeZ Publish Norwegian Public User Group
eZ Publish Norwegian Public User Group
 
Mobile Channels in eZ Publish
Mobile Channels in eZ PublishMobile Channels in eZ Publish
Mobile Channels in eZ Publish
 
Tru club advisor_toolkit_cg_edits_sept101
Tru club advisor_toolkit_cg_edits_sept101Tru club advisor_toolkit_cg_edits_sept101
Tru club advisor_toolkit_cg_edits_sept101
 
How can agencies engage volunteers in supporting a more included life in the...
How can agencies engage volunteers in supporting a more included  life in the...How can agencies engage volunteers in supporting a more included  life in the...
How can agencies engage volunteers in supporting a more included life in the...
 
TGI's February 2011 letter to OIP
TGI's February 2011 letter to OIPTGI's February 2011 letter to OIP
TGI's February 2011 letter to OIP
 
Tn.upi.edu pdf production_and_operations_management
Tn.upi.edu pdf production_and_operations_managementTn.upi.edu pdf production_and_operations_management
Tn.upi.edu pdf production_and_operations_management
 
Daftar produk halal september 2011
Daftar produk halal september 2011Daftar produk halal september 2011
Daftar produk halal september 2011
 
Accenture Spend Trends Report Q2 2014
Accenture Spend Trends Report Q2 2014Accenture Spend Trends Report Q2 2014
Accenture Spend Trends Report Q2 2014
 
INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"
INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"
INFORME: Índice de Confianza Social. ESADE - Obra Social "la Caixa"
 
Berlin LSP : Urban Tech Republic
Berlin LSP : Urban Tech Republic Berlin LSP : Urban Tech Republic
Berlin LSP : Urban Tech Republic
 
Loss mechanisms in Polymer-Fullerene Solar Cells
Loss mechanisms in Polymer-Fullerene Solar CellsLoss mechanisms in Polymer-Fullerene Solar Cells
Loss mechanisms in Polymer-Fullerene Solar Cells
 
How to set up an online community?
How to set up an online community?How to set up an online community?
How to set up an online community?
 
Mac interval tree
Mac interval treeMac interval tree
Mac interval tree
 
HP Brand Identity
HP Brand IdentityHP Brand Identity
HP Brand Identity
 
Freenetlinks
FreenetlinksFreenetlinks
Freenetlinks
 
Republic of Tatarstan: General Overview, State System, Economy
Republic of Tatarstan: General Overview, State System, EconomyRepublic of Tatarstan: General Overview, State System, Economy
Republic of Tatarstan: General Overview, State System, Economy
 
Mad list of filetypes
Mad list of filetypesMad list of filetypes
Mad list of filetypes
 
'Reggae On The Internet: Volume 1'
'Reggae On The Internet: Volume 1''Reggae On The Internet: Volume 1'
'Reggae On The Internet: Volume 1'
 
4000 auto approve wordpress blogs backlink list (pr8-pr1)
4000 auto approve wordpress blogs backlink list (pr8-pr1)4000 auto approve wordpress blogs backlink list (pr8-pr1)
4000 auto approve wordpress blogs backlink list (pr8-pr1)
 
Born Digital - GSE Research presentation
Born Digital - GSE Research presentationBorn Digital - GSE Research presentation
Born Digital - GSE Research presentation
 

Similar to REST API V2 Agenda

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
 
Restful web services rule financial
Restful web services   rule financialRestful web services   rule financial
Restful web services rule financialRule_Financial
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
Unleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web APIUnleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web APIFilip W
 
Using an API
Using an APIUsing an API
Using an APIAdam Culp
 
REST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherREST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherPavan Kumar
 
Session 8 Android Web Services - Part 1.pdf
Session 8 Android Web Services - Part 1.pdfSession 8 Android Web Services - Part 1.pdf
Session 8 Android Web Services - Part 1.pdfEngmohammedAlzared
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST APIstephenbhadran
 
RESTful API-centric Universe
RESTful API-centric UniverseRESTful API-centric Universe
RESTful API-centric UniverseTihomir Opačić
 
REST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxREST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxJason452803
 
KaTe RESTful adapter for SAP Process Integration: Introduction
KaTe RESTful adapter for SAP Process Integration: IntroductionKaTe RESTful adapter for SAP Process Integration: Introduction
KaTe RESTful adapter for SAP Process Integration: IntroductionKate_RESTful
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1vikram singh
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsIdo Flatow
 
WordCamp Wilmington 2017 WP-API Why?
WordCamp Wilmington 2017   WP-API Why?WordCamp Wilmington 2017   WP-API Why?
WordCamp Wilmington 2017 WP-API Why?Evan Mullins
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web ServicesAngelin R
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technologyvikram singh
 

Similar to REST API V2 Agenda (20)

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
 
Restful web services rule financial
Restful web services   rule financialRestful web services   rule financial
Restful web services rule financial
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Unleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web APIUnleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web API
 
Using an API
Using an APIUsing an API
Using an API
 
Rest with Spring
Rest with SpringRest with Spring
Rest with Spring
 
REST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherREST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion Aether
 
Session 8 Android Web Services - Part 1.pdf
Session 8 Android Web Services - Part 1.pdfSession 8 Android Web Services - Part 1.pdf
Session 8 Android Web Services - Part 1.pdf
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST API
 
RESTful API-centric Universe
RESTful API-centric UniverseRESTful API-centric Universe
RESTful API-centric Universe
 
Web api
Web apiWeb api
Web api
 
REST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxREST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptx
 
KaTe RESTful adapter for SAP Process Integration: Introduction
KaTe RESTful adapter for SAP Process Integration: IntroductionKaTe RESTful adapter for SAP Process Integration: Introduction
KaTe RESTful adapter for SAP Process Integration: Introduction
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 
Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
 
WordCamp Wilmington 2017 WP-API Why?
WordCamp Wilmington 2017   WP-API Why?WordCamp Wilmington 2017   WP-API Why?
WordCamp Wilmington 2017 WP-API Why?
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technology
 

More from Bertrand Dunogier

The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016Bertrand Dunogier
 
Dev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenuDev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenuBertrand Dunogier
 
Discover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this productDiscover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this productBertrand Dunogier
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedBertrand Dunogier
 
eZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedeZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedBertrand Dunogier
 
eZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content PublishingeZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content PublishingBertrand Dunogier
 

More from Bertrand Dunogier (8)

The eZ Platform Query Field
The eZ Platform Query FieldThe eZ Platform Query Field
The eZ Platform Query Field
 
The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016
 
Dev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenuDev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenu
 
Discover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this productDiscover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this product
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisited
 
E zsc2012 rest-api-v2
E zsc2012 rest-api-v2E zsc2012 rest-api-v2
E zsc2012 rest-api-v2
 
eZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedeZ Publish Cluster Unleashed
eZ Publish Cluster Unleashed
 
eZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content PublishingeZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content Publishing
 

Recently uploaded

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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
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
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
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
 
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
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
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
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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)
 
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
 
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...
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

REST API V2 Agenda

  • 3. Agenda First things first 1. What is REST 2. eZ publish 5, REST API v2 3. Client API 4. REST server API 5. Examples & practice
  • 5. What is REST REST = REpresentational State Transfer Idempotent GET will NEVER change data Uses HTTP verbs Well known ones: GET, POST More discrete ones: PUT, DELETE Exotic one: PATCH. But it has an RFC. I swear. Safe GET is safe PUT, DELETE are not (especially DELETE). POST usually is not. CRUD support Create, Retrieve, Update, Delete
  • 6. eZ publish 5 REST API
  • 7. eZ Publish 5 REST API Architecture
  • 8. eZ Publish 5 REST API Implementation choices Our REST API provides resources The same resource has different uses depending on the VERB GET /content/objects : lists objects POST /content/objects: creates a new object DELETE /content/objects/x: deletes object X PATCH /content/objects/x: modifies object X We chose not to implement TONS of resources. KISS. Easier maintenance, usage Allows us to keep elements unique. Makes HTTP caching possible API exceptions are always converted to HTTP errors NotFoundException: 404 UnauthorizedException: 401 RuntimeException: 500...
  • 9. eZ Publish 5 REST API Authentication Authentication will be native OAuth 2 Basic SSL client certificate Authentication has a direct impact on the results Each authenticated (or anonymous) user may get different results This is of course based on the eZ Publish users, roles & policies
  • 10. eZ Publish 5 REST API Client / Server communication flow
  • 12. Client SDK Developer first We had two choices : fat server, or fat client. We went with the fat client The server is as simple as possible Complexity lies in the client SDK, which we do provide At least a PHP client SDK Maybe a Javascript SDK. Feel like doing a pull request ? ;-) In an ideal world, Android, iOS... The client SDK mirrors the Public API Public API services, with methods Value Objects Create & Update structs The SAME code can be transparently executed locally or remotely !
  • 14. Server REST API Resources, verbs and resource links The REST API is a thin one The amount of resources is purposefully limited Most resources can be requested with different verbs Each verb will have a different action each action requires a different Request The root resource (/) will list the available root resources This makes the API self-aware It makes evolution easier, by limit the hard coding in client implementations
  • 15. Server SDK Accept headers Resources Responses also depend on the Accept Request header Example on GET /content/objects/1 Accept: application/vnd.ez.api.Content To request a full content, including current version Accept: application/vnd.ez.api.ContentInfo To request a content info, without current version The Response format also depends on the Accept header Accept: application/vnd.ez.api.Content+xml To request an XML Response Accept: application/vnd.ez.api.Content+json To request a JSON Response
  • 16. Server SDK Request example Request GET / HTTP/1.1 Host: api.example.net Accept: application/vnd.ez.api.Root+xml Response HTTP/1.1 200 OK Content-Type: application/vnd.ez.api.Root+xml Content-Length: xxx <?xml version="1.0" encoding="UTF-8"?> <Root> <content href="/content/objects" media-type="application/vnd.ez.api.ContentInfoList+xml"/> <contentTypes href="/content/types" media-type="application/vnd.ez.api.ContentTypeInfoList+xml"/> <users href="/user/users" media-type="application/vnd.ez.api.UserRefList+xml"/> <roles href="/user/roles" media-type="application/vnd.ez.api.RoleList+xml"/> <rootLocation href="/content/locations/1" media-type="application/vnd.ez.api.Location+xml"/> <rootUserGroup href="/user/groups/1/3" media-type="application/vnd.ez.api.UserGroup+xml"/> <rootMediaFolder href="/content/locations/1/43" media-type="application/vnd.ez.api.Location+xml"/> <trash href="/content/trash" media-type="application/vnd.ez.api.LocationList+xml"/> <sections href="/content/sections" media-type="application/vnd.ez.api.SectionList+xml"/> <views href="/content/views" media-type="application/vnd.ez.api.RefList+xml"/> </Root>
  • 17. Server SDK HATEOAS Hypermedia As The Engine Of Application State A « perfect » REST API should be self sufficient Consumers should be able to crawl the API without knowing the structure The root resource lists further resources content list, section list, users, etc Further resources should ultimately provide more links Not done yet, but heavily considered
  • 20. Practice time Setup cd /var/www/ezp-next git fetch git stash git checkout ezsc git clone git://gist.github.com/3658045.git examples cd examples/
  • 21. The end ? Documentation, specs: http://github.com/ezsystems/ezp-next/tree/master/doc/specifications/rest/ Contact Twitter: @bdunogier Google+: Bertrand Dunogier SlideShare: BertrandDunogier