SlideShare a Scribd company logo
> GET /problems/MONEY HTTP/1.1   I	 GOT	 99
                                 PROBLEMS
> Host: localhost
> Accept: */*

< HTTP/1.1 200 OK




> GET /problems/POWER HTTP/1.1
> Host: localhost
                                 BUT	 REST
                                 AINT	 ONE
> Accept: */*

< HTTP/1.1 200 OK



> GET /problems/REST HTTP/1.1
> Host: localhost
> Accept: */*
                                 @adrianfcole
< HTTP/1.1 404 Not Found
PROBLEMS
 ➡Why API
 ➡ReST vs other HTTP APIs?
 ➡Design Patterns vs Real APIs
WHO	 IS	 THIS	 GUY?
๏ @adrianfcole

๏ architect CloudHub at MuleSoft

๏founder jclouds
THANKS
  ★     api-craft
  ★     mattstep
  ★   gtcampbell
  ★       mulies
WHY	 WE	 API

          photo copyright 2005 Sony Pictures
COLLABORATE
GROW	 
ECOSYSTEM
AND	 
INNOVATE
HOW	 
TO	  ReST SOAP
API
HOW	 
TO	  ReST WS-*
API
HOW	 
TO	  ReST ReST   ish

API
HOW	 
TO	  not-soap   HATEOAS
REST
To	 the	 
        Level 0:
        Level 1:
                   Swamp of POX
                   Resources
glory	  Level 2:
        Level 3:
                   Verbs
                   Hypermedia

of	 
REST
> POST /api HTTP/1.1
                         > <SOAP-ENV:Envelope ...>
                           <SOAP-ENV:Body>
                             <m:getAvailableDataSources xmlns:m="




Swamp	 
                               <group xsi:type="xsd:string">ArcWe
                               <service xsi:type="xsd:string">Map
                               <token xsi:type="xsd:string">MyTok
                             </m:getAvailableDataSources>




of	 POX
                           </SOAP-ENV:Body>
                         </SOAP-ENV:Envelope>

                         < HTTP/1.1 200 OK
                         < <?xml version="1.0" encoding="UTF-8"?>
                         <soap:Envelope ...>
                           <soap:Body>
                             <n:getAvailableDataSourcesResponse x
                               <Result href="#id0"/>
                             </n:getAvailableDataSourcesResponse>
All things go over the       <id0 id="id0" soapenc:root="0" xsi:t
                         soapenc:arrayType="ns5:DataSource[21]">
same endpoint as XML           <i href="#id1"/>
                         --snip--
RESOURCES
> GET https://ec2.amazonaws.com/?Action=DeleteVolume&VolumeId=vol-4282672b HTTP/1.1

< HTTP/1.1 200 OK

<DeleteVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/">
  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
  <return>true</return>
</DeleteVolumeResponse>

   --snip--

                         Many URIs, same HTTP method
                          Side-effects are API-specific
VERBS
    > HEAD https://mybucket.s3.amazonaws.com/ HTTP/1.1

    < HTTP/1.1 200 OK




 HTTP verbs mean more than CRUD
    Status codes are meaningful
HYPERMEDIA
    > GET https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-9dd4e03546
    > Accept: application/vnd.vmware.vcloud.catalogItem+xml

    < HTTP/1.1 200 OK
    < Content-Type: application/vnd.vmware.vcloud.catalogItem+xml;version=1.0

    <CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="mycatalog" type="
                 href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a5
        <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml"
              href="https://vcloud/api/v1.0/catalog/7f192dfe-00d1-42f2-9f76-9360
        <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml"
              href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-
        <Link rel="remove"
             href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-9
    --snip--




Discoverability, Self-documenting
What	 makes	 
it	 HYPER?
      ➡Base Type
      ➡Links
abort

                                                  add

                                                  alternate

                                                  disk:attach




    TRANSITIONS                                   edit

                                                  remove

                                                  task




All	 transitions	 are	 discoverable	 via	 links
CONTENT	 
NEGOTIATION
 ➡   Client supplies representation in
    Accept header
 ➡On change, update mediatype
    name or annotate via ;version=N.N
 ➡On overhaul, bump global version
 Accept: application/vnd.VENDOR.PRODUCT.RESOURCE+xml
Representing	 
HyperMedia
    Extend Atom
    Opaque + Link Headers
    HAL
    ...
EXTEND	 ATOM
      Vendor Type, Link elements
      < HTTP/1.1 200 OK
      < Content-Type: application/vnd.vmware.vcloud.catalogItem+xml;version=1.0

      <CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="mycatalog" type="
                   href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a5
          <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml"
                href="https://vcloud/api/v1.0/catalog/7f192dfe-00d1-42f2-9f76-9360
          <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml"
                href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-
          <Link rel="remove"
               href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-9
      --snip--



domain-specific types
inherits link semantics from Atom
Link	 Headers
      Opaque Type, Link elements
      < HTTP/1.1 200 OK
      < Content-Type: image/jpeg
      Link: </images/foo.png>; rel="alternate"; type=”image/png”

      010101010101010101
      --snip--




supports binary types
facilitates intermediaries
Hypertext	 Application	 Language
     Mix-in hypermedia controls into base type
     embed resources for efficiency
     < HTTP/1.1 200 OK
     < Content-Type: application/hal+json

     {
         _links: {
            self: {
              href: '/example',
            }
         },
         _embedded: {},
         name: 'foo',

     --snip--



domain-specific type agnostic
ELEGENT
clients always
know transitions

self-documenting
                   LETS	 USE
and discoverable

version at
                   HATEOAS
media-type
granularity
Perceived	 
Complexity?
Level	 2	 
optimizes	 
for Coarse Grained Versions
    CRUD++
    Limited Representations
    Today’s Tools
    Simplicity over Elegance
IS	 IT	 ALL	 
JUST	 
PRICKLES	 
&	 GOO?
can	 we	 have	 both?
There	       Domain	 Style
           Base	 Format
is	 no	      State	 Transfer
Level2          App	 Flow
 Design
            plus stuff like errors
REST	 Design	 
tools
       ➡Apiary
       ➡Swagger
       ➡iodocs
GOOD	 API	 DESIGNERS	 
UNDERSTAND
 how it is used, and who will use it

 importance of iterations and feedback

 impacts to design beyond development

 there’s no golden hammer   (not even mongo)
TWITTER	 IS	 NOT	 
HATEOAS
         REST
         SEARCH
         STREAM
AWS	 IS	 NOT	 REST	 
AWS	 IS	 GOOD
api designed to parse quickly

simple extension (add new key)

consistent security model

bulk ops
WebSockets	 	 
ain’t	 even
HTTP! Handshake is HTTPish
      Discoverable like ReST

      Full-Duplex
      Uncode or Binary Messages
      TCP Protocol
GOOD	 REST	 APIs
Are consciously designed

Version at the right scope

Don’t leak implementation details

Use auth models relevant to consumer

Are well documented with examples
What	 now?
 ➡join api-craft
 ➡read The REST API Design Handbook
 ➡read Building Hypermedia APIs...
 ➡socialize your ideas
       Thank	 you!

More Related Content

What's hot (20)

PDF
ArgoCD Meetup PPT final.pdf
amanmakwana3
 
PPTX
DevOps 101 - an Introduction to DevOps
Red Gate Software
 
PDF
CD using ArgoCD(KnolX).pdf
Knoldus Inc.
 
PPTX
Implementing SRE practices: SLI/SLO deep dive - David Blank-Edelman - DevOpsD...
DevOpsDays Tel Aviv
 
PPTX
Jenkins tutorial
Mamun Rashid, CCDH
 
PDF
Adopting Open Telemetry as Distributed Tracer on your Microservices at Kubern...
Tonny Adhi Sabastian
 
PDF
GitOps and ArgoCD
Omar Fathy
 
PPTX
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
Simplilearn
 
PDF
Service Mesh on Kubernetes with Istio
Michelle Holley
 
PPTX
Modern CI/CD Pipeline Using Azure DevOps
GlobalLogic Ukraine
 
PDF
Jenkins를 활용한 Openshift CI/CD 구성
rockplace
 
PDF
Distributed Tracing for Kafka with OpenTelemetry with Daniel Kim | Kafka Summ...
HostedbyConfluent
 
PPTX
About DevOps in simple steps
Ihor Odynets
 
PPTX
Introduction to microservices
Anil Allewar
 
PDF
Developing Real-Time Data Pipelines with Apache Kafka
Joe Stein
 
PPTX
Azure DevOps
Juan Fabian
 
PPTX
Microservices Part 3 Service Mesh and Kafka
Araf Karsh Hamid
 
PDF
Domain Driven Design (Ultra) Distilled
Nicola Costantino
 
PDF
Introduction to CICD
Knoldus Inc.
 
PPTX
Azure DevOps AI
AayushAayush16
 
ArgoCD Meetup PPT final.pdf
amanmakwana3
 
DevOps 101 - an Introduction to DevOps
Red Gate Software
 
CD using ArgoCD(KnolX).pdf
Knoldus Inc.
 
Implementing SRE practices: SLI/SLO deep dive - David Blank-Edelman - DevOpsD...
DevOpsDays Tel Aviv
 
Jenkins tutorial
Mamun Rashid, CCDH
 
Adopting Open Telemetry as Distributed Tracer on your Microservices at Kubern...
Tonny Adhi Sabastian
 
GitOps and ArgoCD
Omar Fathy
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
Simplilearn
 
Service Mesh on Kubernetes with Istio
Michelle Holley
 
Modern CI/CD Pipeline Using Azure DevOps
GlobalLogic Ukraine
 
Jenkins를 활용한 Openshift CI/CD 구성
rockplace
 
Distributed Tracing for Kafka with OpenTelemetry with Daniel Kim | Kafka Summ...
HostedbyConfluent
 
About DevOps in simple steps
Ihor Odynets
 
Introduction to microservices
Anil Allewar
 
Developing Real-Time Data Pipelines with Apache Kafka
Joe Stein
 
Azure DevOps
Juan Fabian
 
Microservices Part 3 Service Mesh and Kafka
Araf Karsh Hamid
 
Domain Driven Design (Ultra) Distilled
Nicola Costantino
 
Introduction to CICD
Knoldus Inc.
 
Azure DevOps AI
AayushAayush16
 

Viewers also liked (20)

PDF
VMworld 2013: vCloud Hybrid Service: Enterprise Applications on vCloud Hybrid...
VMworld
 
PPTX
Между молотом и наковальней. Production Quality
SQALab
 
PPT
Что было, что есть, что будет: Current State vs. Common Sense
SQALab
 
PPTX
Аудит команды тестирования в сложном проекте
SQALab
 
PDF
Обратная связь и целеполагание, как маяки надежды тестировщика
SQALab
 
PPTX
Ответственность за качество в разных ИТ-проектах
SQALab
 
PPTX
Три инструмента тест-менеджера для работы с людьми
SQALab
 
PPTX
Управление хаосом, или как жить когда число тестов перевалило за десятки тысяч
SQALab
 
PPTX
Определение pass/fail критериев при тестировании и анализе производительности
SQALab
 
PPTX
Пользовательские требования в жизни тестировщика
SQALab
 
PPTX
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
SQALab
 
PPT
Процесс тестирования в условиях неявных требований
SQALab
 
PPTX
A New Model for Testing
SQALab
 
PPTX
Работа с бизнес-требованиями на стадии выхода продукта
SQALab
 
PPTX
Psychology and testing
SQALab
 
PDF
Метод No-Test-Cases: избавьтесь от тест-кейсов в тестировании
SQALab
 
PPTX
How to reduce your test cases... magically!
SQALab
 
PPTX
Advancing Testing Using Axioms
SQALab
 
PDF
Отряд тест-аналитиков
SQALab
 
PPTX
Examples how to move towards Zero Defects
SQALab
 
VMworld 2013: vCloud Hybrid Service: Enterprise Applications on vCloud Hybrid...
VMworld
 
Между молотом и наковальней. Production Quality
SQALab
 
Что было, что есть, что будет: Current State vs. Common Sense
SQALab
 
Аудит команды тестирования в сложном проекте
SQALab
 
Обратная связь и целеполагание, как маяки надежды тестировщика
SQALab
 
Ответственность за качество в разных ИТ-проектах
SQALab
 
Три инструмента тест-менеджера для работы с людьми
SQALab
 
Управление хаосом, или как жить когда число тестов перевалило за десятки тысяч
SQALab
 
Определение pass/fail критериев при тестировании и анализе производительности
SQALab
 
Пользовательские требования в жизни тестировщика
SQALab
 
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
SQALab
 
Процесс тестирования в условиях неявных требований
SQALab
 
A New Model for Testing
SQALab
 
Работа с бизнес-требованиями на стадии выхода продукта
SQALab
 
Psychology and testing
SQALab
 
Метод No-Test-Cases: избавьтесь от тест-кейсов в тестировании
SQALab
 
How to reduce your test cases... magically!
SQALab
 
Advancing Testing Using Axioms
SQALab
 
Отряд тест-аналитиков
SQALab
 
Examples how to move towards Zero Defects
SQALab
 
Ad

Similar to I got 99 problems, but ReST ain't one (20)

PDF
Why Integrate using an API? | MuleSoft
MuleSoft
 
PPTX
RESTful for opentravel.org by HP
Roni Schuetz
 
PDF
Doing REST Right
Kerry Buckley
 
PDF
Ws rest
patriknw
 
PDF
Netflix OSS and HATEOAS deployed on production - JavaLand
JWORKS powered by Ordina
 
PPT
RESTful SOA - 中科院暑期讲座
Li Yi
 
PDF
So you think you know REST - DPC11
Evert Pot
 
KEY
Designing a RESTful web service
Filip Blondeel
 
PDF
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Alliance
 
PDF
Microservices with Netflix OSS & Hypermedia APIs - JavaDay Kiev
JWORKS powered by Ordina
 
PDF
Best Practice in Web Service Design
Lorna Mitchell
 
PDF
distributing over the web
Nicola Baldi
 
KEY
Rest experience-report
Jim Barritt
 
KEY
A Conversation About REST
Mike Wilcox
 
KEY
A Conversation About REST
Jeremy Brown
 
PDF
ReST Vs SOA(P) ... Yawn
ozten
 
PPTX
Rest APIs Training
Shekhar Kumar
 
PPTX
Introduction to Web Services
Jeffrey Anderson
 
PDF
Api Design and More (Friday Training at Itnig)
itnig
 
PPTX
RESTful Services
Jason Gerard
 
Why Integrate using an API? | MuleSoft
MuleSoft
 
RESTful for opentravel.org by HP
Roni Schuetz
 
Doing REST Right
Kerry Buckley
 
Ws rest
patriknw
 
Netflix OSS and HATEOAS deployed on production - JavaLand
JWORKS powered by Ordina
 
RESTful SOA - 中科院暑期讲座
Li Yi
 
So you think you know REST - DPC11
Evert Pot
 
Designing a RESTful web service
Filip Blondeel
 
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Alliance
 
Microservices with Netflix OSS & Hypermedia APIs - JavaDay Kiev
JWORKS powered by Ordina
 
Best Practice in Web Service Design
Lorna Mitchell
 
distributing over the web
Nicola Baldi
 
Rest experience-report
Jim Barritt
 
A Conversation About REST
Mike Wilcox
 
A Conversation About REST
Jeremy Brown
 
ReST Vs SOA(P) ... Yawn
ozten
 
Rest APIs Training
Shekhar Kumar
 
Introduction to Web Services
Jeffrey Anderson
 
Api Design and More (Friday Training at Itnig)
itnig
 
RESTful Services
Jason Gerard
 
Ad

More from Adrian Cole (6)

PDF
HTTP/2 What's inside and Why
Adrian Cole
 
PDF
Efficient HTTP Apis
Adrian Cole
 
PPTX
Using and contributing to the next Guice
Adrian Cole
 
PPT
jclouds overview
Adrian Cole
 
PPTX
Living on the edge
Adrian Cole
 
PPT
When small problems become big problems
Adrian Cole
 
HTTP/2 What's inside and Why
Adrian Cole
 
Efficient HTTP Apis
Adrian Cole
 
Using and contributing to the next Guice
Adrian Cole
 
jclouds overview
Adrian Cole
 
Living on the edge
Adrian Cole
 
When small problems become big problems
Adrian Cole
 

Recently uploaded (20)

PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Trading Volume Explained by CIFDAQ- Secret Of Market Trends
CIFDAQ
 
PPTX
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
PDF
Productivity Management Software | Workstatus
Lovely Baghel
 
PPTX
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
PDF
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
PDF
2025-07-15 EMEA Volledig Inzicht Dutch Webinar
ThousandEyes
 
PDF
Upskill to Agentic Automation 2025 - Kickoff Meeting
DianaGray10
 
PPTX
Machine Learning Benefits Across Industries
SynapseIndia
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
Bitcoin+ Escalando sin concesiones - Parte 1
Fernando Paredes García
 
PDF
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PDF
HR agent at Mediq: Lessons learned on Agent Builder & Maestro by Tacstone Tec...
UiPathCommunity
 
PDF
UiPath vs Other Automation Tools Meeting Presentation.pdf
Tracy Dixon
 
PDF
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
PPTX
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Trading Volume Explained by CIFDAQ- Secret Of Market Trends
CIFDAQ
 
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
Productivity Management Software | Workstatus
Lovely Baghel
 
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
2025-07-15 EMEA Volledig Inzicht Dutch Webinar
ThousandEyes
 
Upskill to Agentic Automation 2025 - Kickoff Meeting
DianaGray10
 
Machine Learning Benefits Across Industries
SynapseIndia
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
Bitcoin+ Escalando sin concesiones - Parte 1
Fernando Paredes García
 
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
HR agent at Mediq: Lessons learned on Agent Builder & Maestro by Tacstone Tec...
UiPathCommunity
 
UiPath vs Other Automation Tools Meeting Presentation.pdf
Tracy Dixon
 
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 

I got 99 problems, but ReST ain't one

  • 1. > GET /problems/MONEY HTTP/1.1 I GOT 99 PROBLEMS > Host: localhost > Accept: */* < HTTP/1.1 200 OK > GET /problems/POWER HTTP/1.1 > Host: localhost BUT REST AINT ONE > Accept: */* < HTTP/1.1 200 OK > GET /problems/REST HTTP/1.1 > Host: localhost > Accept: */* @adrianfcole < HTTP/1.1 404 Not Found
  • 2. PROBLEMS ➡Why API ➡ReST vs other HTTP APIs? ➡Design Patterns vs Real APIs
  • 3. WHO IS THIS GUY? ๏ @adrianfcole ๏ architect CloudHub at MuleSoft ๏founder jclouds
  • 4. THANKS ★ api-craft ★ mattstep ★ gtcampbell ★ mulies
  • 5. WHY WE API photo copyright 2005 Sony Pictures
  • 7. HOW TO ReST SOAP API
  • 8. HOW TO ReST WS-* API
  • 9. HOW TO ReST ReST ish API
  • 10. HOW TO not-soap HATEOAS REST
  • 11. To the Level 0: Level 1: Swamp of POX Resources glory Level 2: Level 3: Verbs Hypermedia of REST
  • 12. > POST /api HTTP/1.1 > <SOAP-ENV:Envelope ...> <SOAP-ENV:Body> <m:getAvailableDataSources xmlns:m=" Swamp <group xsi:type="xsd:string">ArcWe <service xsi:type="xsd:string">Map <token xsi:type="xsd:string">MyTok </m:getAvailableDataSources> of POX </SOAP-ENV:Body> </SOAP-ENV:Envelope> < HTTP/1.1 200 OK < <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope ...> <soap:Body> <n:getAvailableDataSourcesResponse x <Result href="#id0"/> </n:getAvailableDataSourcesResponse> All things go over the <id0 id="id0" soapenc:root="0" xsi:t soapenc:arrayType="ns5:DataSource[21]"> same endpoint as XML <i href="#id1"/> --snip--
  • 13. RESOURCES > GET https://ec2.amazonaws.com/?Action=DeleteVolume&VolumeId=vol-4282672b HTTP/1.1 < HTTP/1.1 200 OK <DeleteVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </DeleteVolumeResponse> --snip-- Many URIs, same HTTP method Side-effects are API-specific
  • 14. VERBS > HEAD https://mybucket.s3.amazonaws.com/ HTTP/1.1 < HTTP/1.1 200 OK HTTP verbs mean more than CRUD Status codes are meaningful
  • 15. HYPERMEDIA > GET https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-9dd4e03546 > Accept: application/vnd.vmware.vcloud.catalogItem+xml < HTTP/1.1 200 OK < Content-Type: application/vnd.vmware.vcloud.catalogItem+xml;version=1.0 <CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="mycatalog" type=" href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a5 <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloud/api/v1.0/catalog/7f192dfe-00d1-42f2-9f76-9360 <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f- <Link rel="remove" href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-9 --snip-- Discoverability, Self-documenting
  • 16. What makes it HYPER? ➡Base Type ➡Links
  • 17. abort add alternate disk:attach TRANSITIONS edit remove task All transitions are discoverable via links
  • 18. CONTENT NEGOTIATION ➡ Client supplies representation in Accept header ➡On change, update mediatype name or annotate via ;version=N.N ➡On overhaul, bump global version Accept: application/vnd.VENDOR.PRODUCT.RESOURCE+xml
  • 19. Representing HyperMedia Extend Atom Opaque + Link Headers HAL ...
  • 20. EXTEND ATOM Vendor Type, Link elements < HTTP/1.1 200 OK < Content-Type: application/vnd.vmware.vcloud.catalogItem+xml;version=1.0 <CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="mycatalog" type=" href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a5 <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloud/api/v1.0/catalog/7f192dfe-00d1-42f2-9f76-9360 <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f- <Link rel="remove" href="https://vcloud/api/v1.0/catalogItem/1c01defe-1111-42ac-a50f-9 --snip-- domain-specific types inherits link semantics from Atom
  • 21. Link Headers Opaque Type, Link elements < HTTP/1.1 200 OK < Content-Type: image/jpeg Link: </images/foo.png>; rel="alternate"; type=”image/png” 010101010101010101 --snip-- supports binary types facilitates intermediaries
  • 22. Hypertext Application Language Mix-in hypermedia controls into base type embed resources for efficiency < HTTP/1.1 200 OK < Content-Type: application/hal+json { _links: { self: { href: '/example', } }, _embedded: {}, name: 'foo', --snip-- domain-specific type agnostic
  • 23. ELEGENT clients always know transitions self-documenting LETS USE and discoverable version at HATEOAS media-type granularity
  • 25. Level 2 optimizes for Coarse Grained Versions CRUD++ Limited Representations Today’s Tools Simplicity over Elegance
  • 26. IS IT ALL JUST PRICKLES & GOO?
  • 27. can we have both?
  • 28. There Domain Style Base Format is no State Transfer Level2 App Flow Design plus stuff like errors
  • 29. REST Design tools ➡Apiary ➡Swagger ➡iodocs
  • 30. GOOD API DESIGNERS UNDERSTAND how it is used, and who will use it importance of iterations and feedback impacts to design beyond development there’s no golden hammer (not even mongo)
  • 31. TWITTER IS NOT HATEOAS REST SEARCH STREAM
  • 32. AWS IS NOT REST AWS IS GOOD api designed to parse quickly simple extension (add new key) consistent security model bulk ops
  • 33. WebSockets ain’t even HTTP! Handshake is HTTPish Discoverable like ReST Full-Duplex Uncode or Binary Messages TCP Protocol
  • 34. GOOD REST APIs Are consciously designed Version at the right scope Don’t leak implementation details Use auth models relevant to consumer Are well documented with examples
  • 35. What now? ➡join api-craft ➡read The REST API Design Handbook ➡read Building Hypermedia APIs... ➡socialize your ideas Thank you!

Editor's Notes

  • #2: \n
  • #3: we need to define what we are talking about, and then evaluate patterns\n
  • #4: \n
  • #5: \n
  • #6: Now that we are here, we underscore motivations to even bother with.\n
  • #7: A Web API Study: Hurwitz;\n leads to integration -&gt; stronger ecosystem -&gt; more value\n &gt; devices and applications in the ecosystem\n\n
  • #8: At first glance, we might think how to present an api is rest vs soap\n
  • #9: it might really be the aspects of WS-* that would make such a decision, such as WS-Security, AtomicTransaction, ReliableMessaging\n
  • #10: Say we chose, ReST.. the thing is that ReST means a lot to many people\n
  • #11: ends up being something between soap and hypertext driven\n
  • #12: Leonard Richardson circa 2008 Maturity Model\n
  • #13: Easiest example of POX is tunneling commands over a single http request/response paradigm\n
  • #14: many uris, but a single invocation method. operations might be encoded in parameters, and resource might be mixed in with them\n
  • #15: HEAD is metadata; PATCH is for update; PUT is replace; POST -&gt; RPC/create\natomicity underpins idempotence; by spec POST can affect multiple resources, but most others (except notably trace,options) only apply to the resource identified by the href\n
  • #16: \n
  • #17: \n
  • #18: HATEOAS is basically a state machine. Your responsibility is to not attempt any transition undefined in links\n
  • #19: New resources types can be added without breaking client, as can new fields/links\nabove pattern recommended by: Dan Feist\n\nOther option you can use is link with profile relation.\n
  • #20: There are other ways, too...\nxlink can decorate in namespace of xml, but doesn&amp;#x2019;t expose representations\ncollection+json is an interesting approach for managing collections (includes its own data format)\n
  • #21: \n
  • #22: ex. cache intermediaries http://tools.ietf.org/html/draft-nottingham-linked-cache-inv-03\n
  • #23: define domain-specific type using type link parameter, or via custom rel or profile link (preferred)\nhttp://tools.ietf.org/id/draft-kelly-json-hal\nalso supports templated urls such as queries\n
  • #24: \n
  • #25: sometimes domain models are well defined, so the added value may be lost on the user\n
  • #26: Leonard Richardson circa 2008 Maturity Model\n
  • #27: Prickles &amp; Goo: Alan Watts Trey Parker Matt Stone\nIs culture behind adoption of a particular rest approach? Even if the approach is correct, can you persuade devs to adopt something they don&amp;#x2019;t want?\n
  • #28: we are probably at various intervals on the same plane. more detail == overly complex. not enough == naive.\n
  • #29: Amundsen, Mike (2011-11-22). Building Hypermedia APIs with HTML5 and Node (p. 20). OReilly Media - A. Kindle Edition. \n
  • #30: http://apiary.io/ &lt; markdown extension describes behavior, generates mock and tests it\nhttp://swagger.wordnik.com/ &lt;- json describes resource, apis, models, generates many clients\nhttps://github.com/mashery/iodocs &lt;- json describes service, apis, creates javascript client\n
  • #31: database details such as pagination, etc\n\ntransition to a design that isn&amp;#x2019;t rest (aws)\n
  • #32: original has been around since 2008, latest update mainly addressed oauth and rate limiting changes; thanks Greg Campbell for insight; api is versioned as 1.1, but includes 3 distinct apis\naside: search can be modeled in HATEOAS, where POST is creation of search results, HEAD returns lifespan, etc\n\n
  • #33: Many amazon web services do not even follow type 2 classifications, yet they are widely adopted, and successful.. why is that? why do they not use rest?\n\ngurupa is the amazon http server, which is tuned for query parsing. language for extending it is simple (add a key), so parsing it to verify signature is just sort the keys and sign it.\n\nbulk ops like s3 multi-delete help deal with very large problems.\n
  • #34: Ex. ELB you have to use TCP/SSL as this is not a HTTP compatible protocol\nconsider impact for example lack of origin IP address, sticky session\nnew set of gateway products will emerge to support WebSockets\n
  • #35: database details such as pagination, etc\n
  • #36: \n