SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a E zsc2012 rest-api-v2

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
 

Semelhante a E zsc2012 rest-api-v2 (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
 

Mais de 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
 

Mais de 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
 
eZ Publish REST API v2
eZ Publish REST API v2eZ Publish REST API v2
eZ Publish 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
 

Último

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
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
"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
 
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
 
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
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
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
 

Último (20)

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
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
"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...
 
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...
 
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
 
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!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
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)
 

E zsc2012 rest-api-v2

  • 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