SlideShare uma empresa Scribd logo
1 de 25
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
Taming The RESTed NARWHL
Striking the Balance Between
Usability and Zealotry in REST
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
2
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
3
Is this RESTful?
http://api.example.com/events/query.json?id=87465
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
4
What About This?
Find “Rob Zazueta” in the employee Database.
GET /countries
[
"/countries/usa/states",
"/countries/can/provinces",
...
]
GET /countries/usa/states
[
"/countries/usa/states/al",
"/countries/usa/states/ak",
...
]
GET /countries/usa/states/ca
[
"/countries/usa/states/ca/divisions",
"/countries/usa/states/ca/employees",
...
]
GET /countries/usa/states/ca/employees
[
"/countries/usa/states/ca/employees/alan_akbar",
"/countries/usa/states/ca/employees/bill_allen"
...
]
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
5
“What is a REST API?”
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
A design framework to build RESTful
APIs intended for consumption by
applications built by people
6
Introducing the RESTed NARWHL
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
The RESTed NARWHL
http://www.narwhl.com
7
PLEASE PROVIDE YOUR FEEDBACK!
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
8
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
Noun
As
Resource
With
Hyper
Links
9
1. It’s how I describe intuitive APIs
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
10
2. Narwhals are an awesome mashup
+ =
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
11
3. Narwhals are real.
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
12
Obligatory RMM Slide
Source: http://martinfowler.com/articles/richardsonMaturityModel.html
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
• A customer wants to browse for products by
category.
• A customer wants to add a product to their
shopping cart.
• A store admin wants to list all customers who
bought a given product.
13
Use Cases Uncover Resources
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
• A customer wants to browse for products by
category.
• A customer wants to add a product to their
shopping cart.
• A store admin wants to list all customers who
bought a given product.
14
Use Cases Uncover Resources
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
• Customers
• Products
• Categories
• Shopping Cart
• Store Admin
15
Use Cases Uncover Resources
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
16
Endpoint Design Matters
/{resource_name}/{resource_identifier}
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
17
Endpoint Design Matters
/products/73924
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
18
Endpoint Design Matters
/categories/39/products/73924
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
19
Endpoint Design Matters
Link: <http://api.example.com/v1/products/73924>; rel="canonical"
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
Start using specific MIME types in your
responses – even custom ones.
NO - Content-Type: text/json
YES – Content-Type:
application/vnd.example.products.json+v1
20
Saner Versioning Through Content Negotiation
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
SDKs Suck Because:
• They’re one more thing to maintain
• They often assume functionality outside the API
• They get bloated
21Dynamic Client Generation Through Response Profiles
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
Dynamic Code Libraries Rock Because:
• They reflect only what’s defined in the API
• They grow and change as the API iterates
• They feel more native to the developer
22Dynamic Client Generation Through Response Profiles
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
23
NARWHL Maturity Model*
Level 0: Nouns as Resources With Hyperlinks
Level 1: NARWHL JSON Responses
Level 2: Content Negotiation
Level 3: Response Profiles & Definitions
Awesomeness of NARWHL
*With apologies and thanks to Martin Fowler and Leonard Richardson
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
The RESTed NARWHL
http://www.narwhl.com
24
SERIOUSLY. DON’T MAKE ME BEG.
© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L
25

Mais conteúdo relacionado

Semelhante a Taming the RESTed NARWHL: Striking the Balance Between Usability and Zealotry in REST.

Optimizing Website Performance in the Age of Mobile & Social
Optimizing Website Performance in the Age of Mobile & Social Optimizing Website Performance in the Age of Mobile & Social
Optimizing Website Performance in the Age of Mobile & Social Yottaa
 
Cloud Identity Deployed
Cloud Identity DeployedCloud Identity Deployed
Cloud Identity DeployedPablo Valarezo
 
A Study In Mobile Growth: Becoming Your Customers' Ritual
A Study In Mobile Growth: Becoming Your Customers' RitualA Study In Mobile Growth: Becoming Your Customers' Ritual
A Study In Mobile Growth: Becoming Your Customers' RitualKathleen Waugh
 
The New Patterns of Innovation
The New Patterns of InnovationThe New Patterns of Innovation
The New Patterns of InnovationSushant Kumar
 
Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing
Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing
Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing OTTOMotors
 
Growth Framework for Consumer Startups
Growth Framework for Consumer StartupsGrowth Framework for Consumer Startups
Growth Framework for Consumer StartupsP J
 
Benefits of Trail-Oriented Development
Benefits of Trail-Oriented Development Benefits of Trail-Oriented Development
Benefits of Trail-Oriented Development Phil Mays
 
SharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mindSharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mindChris Johnson
 
From Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsFrom Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsRonald Ashri
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsRonald Ashri
 
Developing Project Clarity with a simple RACI Framework
Developing Project Clarity with a simple RACI FrameworkDeveloping Project Clarity with a simple RACI Framework
Developing Project Clarity with a simple RACI FrameworkKevin McDonnell
 

Semelhante a Taming the RESTed NARWHL: Striking the Balance Between Usability and Zealotry in REST. (20)

Optimizing Website Performance in the Age of Mobile & Social
Optimizing Website Performance in the Age of Mobile & Social Optimizing Website Performance in the Age of Mobile & Social
Optimizing Website Performance in the Age of Mobile & Social
 
Cloud Identity Deployed
Cloud Identity DeployedCloud Identity Deployed
Cloud Identity Deployed
 
A Study In Mobile Growth: Becoming Your Customers' Ritual
A Study In Mobile Growth: Becoming Your Customers' RitualA Study In Mobile Growth: Becoming Your Customers' Ritual
A Study In Mobile Growth: Becoming Your Customers' Ritual
 
ROne
ROneROne
ROne
 
the_swft_product_overview_11072016
the_swft_product_overview_11072016the_swft_product_overview_11072016
the_swft_product_overview_11072016
 
The New Patterns of Innovation
The New Patterns of InnovationThe New Patterns of Innovation
The New Patterns of Innovation
 
Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing
Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing
Say "Hello" to Industry 4.0: Flexible automation & the future of manufacturing
 
HPMC 2014 - The value of analytics - SAS
HPMC 2014 - The value of analytics - SASHPMC 2014 - The value of analytics - SAS
HPMC 2014 - The value of analytics - SAS
 
Croosing
Croosing Croosing
Croosing
 
Vb & asp
Vb & aspVb & asp
Vb & asp
 
Growth Framework for Consumer Startups
Growth Framework for Consumer StartupsGrowth Framework for Consumer Startups
Growth Framework for Consumer Startups
 
The Digital Transformation: A New World Order
The Digital Transformation: A New World OrderThe Digital Transformation: A New World Order
The Digital Transformation: A New World Order
 
Benefits of Trail-Oriented Development
Benefits of Trail-Oriented Development Benefits of Trail-Oriented Development
Benefits of Trail-Oriented Development
 
Cloud benefits
Cloud benefitsCloud benefits
Cloud benefits
 
SharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mindSharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mind
 
From Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsFrom Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dots
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the Dots
 
BS portfolio
BS portfolioBS portfolio
BS portfolio
 
Five Hallmarks of Industry Cloud Companies
Five Hallmarks of Industry Cloud CompaniesFive Hallmarks of Industry Cloud Companies
Five Hallmarks of Industry Cloud Companies
 
Developing Project Clarity with a simple RACI Framework
Developing Project Clarity with a simple RACI FrameworkDeveloping Project Clarity with a simple RACI Framework
Developing Project Clarity with a simple RACI Framework
 

Último

Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsMonica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiAbu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiMonica Sydney
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理F
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsPriya Reddy
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...gajnagarg
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 

Último (20)

Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiAbu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 

Taming the RESTed NARWHL: Striking the Balance Between Usability and Zealotry in REST.

  • 1. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L© 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L Taming The RESTed NARWHL Striking the Balance Between Usability and Zealotry in REST
  • 2. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 2
  • 3. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 3 Is this RESTful? http://api.example.com/events/query.json?id=87465
  • 4. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 4 What About This? Find “Rob Zazueta” in the employee Database. GET /countries [ "/countries/usa/states", "/countries/can/provinces", ... ] GET /countries/usa/states [ "/countries/usa/states/al", "/countries/usa/states/ak", ... ] GET /countries/usa/states/ca [ "/countries/usa/states/ca/divisions", "/countries/usa/states/ca/employees", ... ] GET /countries/usa/states/ca/employees [ "/countries/usa/states/ca/employees/alan_akbar", "/countries/usa/states/ca/employees/bill_allen" ... ]
  • 5. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 5 “What is a REST API?”
  • 6. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L A design framework to build RESTful APIs intended for consumption by applications built by people 6 Introducing the RESTed NARWHL
  • 7. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L The RESTed NARWHL http://www.narwhl.com 7 PLEASE PROVIDE YOUR FEEDBACK!
  • 8. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 8
  • 9. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L Noun As Resource With Hyper Links 9 1. It’s how I describe intuitive APIs
  • 10. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 10 2. Narwhals are an awesome mashup + =
  • 11. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 11 3. Narwhals are real.
  • 12. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 12 Obligatory RMM Slide Source: http://martinfowler.com/articles/richardsonMaturityModel.html
  • 13. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L • A customer wants to browse for products by category. • A customer wants to add a product to their shopping cart. • A store admin wants to list all customers who bought a given product. 13 Use Cases Uncover Resources
  • 14. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L • A customer wants to browse for products by category. • A customer wants to add a product to their shopping cart. • A store admin wants to list all customers who bought a given product. 14 Use Cases Uncover Resources
  • 15. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L • Customers • Products • Categories • Shopping Cart • Store Admin 15 Use Cases Uncover Resources
  • 16. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 16 Endpoint Design Matters /{resource_name}/{resource_identifier}
  • 17. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 17 Endpoint Design Matters /products/73924
  • 18. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 18 Endpoint Design Matters /categories/39/products/73924
  • 19. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 19 Endpoint Design Matters Link: <http://api.example.com/v1/products/73924>; rel="canonical"
  • 20. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L Start using specific MIME types in your responses – even custom ones. NO - Content-Type: text/json YES – Content-Type: application/vnd.example.products.json+v1 20 Saner Versioning Through Content Negotiation
  • 21. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L SDKs Suck Because: • They’re one more thing to maintain • They often assume functionality outside the API • They get bloated 21Dynamic Client Generation Through Response Profiles
  • 22. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L Dynamic Code Libraries Rock Because: • They reflect only what’s defined in the API • They grow and change as the API iterates • They feel more native to the developer 22Dynamic Client Generation Through Response Profiles
  • 23. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 23 NARWHL Maturity Model* Level 0: Nouns as Resources With Hyperlinks Level 1: NARWHL JSON Responses Level 2: Content Negotiation Level 3: Response Profiles & Definitions Awesomeness of NARWHL *With apologies and thanks to Martin Fowler and Leonard Richardson
  • 24. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L The RESTed NARWHL http://www.narwhl.com 24 SERIOUSLY. DON’T MAKE ME BEG.
  • 25. © 2 0 1 4 M a s h e r y , I n c . — P R O P R I E T A R Y A N D C O N F I D E N T I A L 25

Notas do Editor

  1. Thank you for listening to me yammer for the next 30 minutes. I love the API community. There are incredibly smart and passionate people who are eager to connect us to the future. I have a great deal of respect for all of them and their ideas and I love jumping into the fray on the API Craft group, at conferences like RESTfest and, of course, right here at Gluecon.
  2. I can not stand peoplewho identify problems without suggesting solutions. I tend to believe you become part of the problem at that point.
  3. Don’t let your API’s design surprise your developer customers; surprise them, instead, with the cool things you can do with it.
  4. This is perhaps the most important point. APIs can not live in the abstract and expect to survive – they need to get out there and be used. NARWHL is intended for teams who need to get past the debate and build an API today.
  5. No talk about RESTful APIs can be legally delivered without mentioning both Roy Fielding’s 2000 thesis and the Richardson Maturity Model. IF you leave it out, expect to get a ticket in the mail. NARWHL starts where the RMM ends. It is by default intended to be RMM Level 3 compliant, but to add some additional structure based on best practices that are already in the wild and that are recommended. I’m not talking about anything revolutionary here – this should look familiar to you. And that’s the point.