![Page 1: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/1.jpg)
Mike Carey – ReST Done RightNovember 2017
![Page 2: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/2.jpg)
Meet Mike
2008:JavaEngineeratWalmart
2010:IntroducedtoAgile(Scrum)
2011:AgileUserGroup/ScrumMaster
2013:AgileCoach
2015:DeliveryManagerinD.C.Office
2017:WalmartLabs
![Page 3: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/3.jpg)
Assumptions & BaselineReST TheoryReST in the WildSo What?
Talking Points
01020304
![Page 4: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/4.jpg)
Assumptions & BaselineReST TheoryReST in the WildSo What?
Talking Points
01020304
![Page 5: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/5.jpg)
Who are you?
•Technical
•Non-Technical
![Page 6: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/6.jpg)
What do you want?
What are you hoping to take away from this session?
![Page 7: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/7.jpg)
Assumptions & BaselineReST TheoryReST in the WildSo What?
Talking Points
01020304
![Page 8: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/8.jpg)
All the Buzzwords!
Credit:http://hyperboleandahalf.blogspot.com/2010/06/this-is-why-ill-never-be-adult.html
![Page 9: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/9.jpg)
All the Buzzwords!
• Service-Oriented Architecture (SOA)
•Microservices
• Representational State Transfer (ReST)
![Page 10: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/10.jpg)
Where did ReST come from?
![Page 11: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/11.jpg)
Where did ReST come from?
• Dr. Roy Fielding’s 2000 Dissertation, “Architectural Styles andthe Design of Network-based Software Architectures”
• Written as a result of defending the design choices of the Internet for 4 years in the late ‘90s
![Page 12: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/12.jpg)
Why is ReST important?
• Defines a “core set of principles, properties, and constraints”
• Leverages existing HTTP standards
• Provides greater flexibility than SOAP, other protocols
![Page 13: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/13.jpg)
Let’s ReST!
RepresentationalStateTransfer
![Page 14: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/14.jpg)
Let’s ReST!
RepresentationalStateTransfer
![Page 15: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/15.jpg)
Let’s ReST!
RepresentationalStateTransfer
![Page 16: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/16.jpg)
Let’s ReST!
RepresentationalStateTransfer
![Page 17: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/17.jpg)
Constraint #1
Client-Server Architecture
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
![Page 18: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/18.jpg)
Constraint #1
Client-Server Architecture
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
![Page 19: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/19.jpg)
Constraint #1
Client-Server Architecture
Allows for independent scaling of each
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
![Page 20: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/20.jpg)
Constraint #2
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Statelessness
![Page 21: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/21.jpg)
Constraint #2
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Statelessness
![Page 22: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/22.jpg)
Constraint #2
Allows for visibility, reliability, and scalabilityCredit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Statelessness
![Page 23: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/23.jpg)
Constraint #3
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Cacheability
![Page 24: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/24.jpg)
Constraint #3
Cacheability
Request
Response
Copy ofResponse
![Page 25: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/25.jpg)
Constraint #3
Cacheability
Request
Response
![Page 26: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/26.jpg)
Constraint #3
Improves efficiency, scalability, perceived performance at cost of reliability
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Cacheability
![Page 27: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/27.jpg)
Constraint #4
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Uniform Interface
![Page 28: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/28.jpg)
Constraint #4
Uniform Interface
vs
![Page 29: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/29.jpg)
Constraint #4
Enhances simplicity & visibility at the cost of efficiency
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Uniform Interface
![Page 30: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/30.jpg)
Constraint #5
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Layered System
![Page 31: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/31.jpg)
Constraint #5
Simplifies components at risk of increased latency for the whole
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Layered System
![Page 32: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/32.jpg)
Constraint #6
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Code on Demand (optional)
![Page 33: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/33.jpg)
Constraint #6
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Code on Demand (optional)
![Page 34: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/34.jpg)
Constraint #6
Potentially enhances client experience at the expense of visibility
Credit: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Code on Demand (optional)
![Page 35: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/35.jpg)
Assumptions & BaselineReST TheoryReST in the WildSo What?
Talking Points
01020304
![Page 36: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/36.jpg)
Where the Wild Things Are
Credit: Maurice Sendak, “Where the Wild Things Are”
![Page 37: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/37.jpg)
Richardson Maturity Model
• Defined by Leonard Richardson in 2008 (?)
• Best explained by Martin Fowler in 2010
• Presented to you with real life(ish) examples
![Page 38: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/38.jpg)
![Page 39: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/39.jpg)
![Page 40: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/40.jpg)
Richardson Maturity Model – Level 0
• Uses HTTP as transport system
•Does not leverage HTTP mechanisms, i.e.•Methods/Verbs• Response Codes
• SOAP, XML-RPC
![Page 41: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/41.jpg)
Richardson Maturity Model – Level 0
Request (POST):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/><SOAP-ENV:Body>
<ns4:getItemDetails xmlns:ns3="http://xmlns.walmartstores.com/ns3Path" xmlns:ns4="http://xmlns.walmartstores.com/ns4Path" xmlns:ns5="http://xmlns.walmartstores.com/ns5Path">
<upcNumber>4391797660</upcNumber></ns4:getItemDetails>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
Response (200 OK):
<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-
open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1"/>
</soapenv:Header><soapenv:Body>
<n:getItemDetailsResponsexmlns:n="http://www.xmlns.walmartstores.com/nPath">
<return><errors>Error Code:1000
</errors></return></n:getItemDetailsResponse>
</soapenv:Body></soapenv:Envelope>
URI: http://www.hostname.com/path/GetItemInfo
![Page 42: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/42.jpg)
Richardson Maturity Model – Level 0
Request (POST):
{"arg0": {
"authMethod":"","countryCd":"US","itemInfo":[{
"upc":"000004391797660"}],"languageCd":"ENG","reqDateTime":"2017-10-24","storeNbr":100
}}
Response (200 OK):
{"messageFault": {
"errorCode":200,"errorNode":null,"errorDesc":null,"errorText":"Success"
},"item": {
"details": {...
},..."xparams":null
}}
URI: http://www.hostname.com/path/GetItemInfo
![Page 43: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/43.jpg)
Richardson Maturity Model – Level 1
• Level 0 + Resources
• URIs are unique to resources
• Responses are Resource Representations
![Page 44: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/44.jpg)
Richardson Maturity Model – Level 1
Request (POST):
{"arg0": {
"authMethod":"","countryCd":"US","itemInfo":[{
"upc":"000004391797660"}],"languageCd":"ENG","reqDateTime":"2017-10-24","storeNbr":100
}}
Response (200 OK):
{"payload": {
"item": {"itemName": "FRONTLINE LARGE DOG","upc": "0000350604287200","multiPackStatus": false,"hazMat": false,"hazwaste": false,...
},"supplier": {...}
}}
URI: http://www.hostname.com/path/items/123456
![Page 45: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/45.jpg)
Richardson Maturity Model – Level 1
• I have not encountered in the wild
• If they think to use resources,they usually think to use HTTP verbs
Credit:http://pbfcomics.com/comics/the-last-unicorns/
![Page 46: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/46.jpg)
Richardson Maturity Model – Level 2
• Proper use of HTTP verbs
•GET• POST• PUT• PATCH•DELETE
• Read• Create• Update (wholesale)• Update (partial)•Delete
![Page 47: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/47.jpg)
Richardson Maturity Model – Level 2
•Generally also proper use of return codes
• 200 OK• 400 BAD REQUEST• 404 NOT FOUND• 418 I’M A TEAPOT• 500 INTERNAL SERVER ERROR
![Page 48: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/48.jpg)
Richardson Maturity Model – Level 2
• 62 Standard codes•Organized by category• 1xx: Informational• 2xx: Success• 3xx: Redirection• 4xx: Client Error• 5xx: Server Error
![Page 49: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/49.jpg)
Richardson Maturity Model – Level 2
Request (GET):
No Request Body
Resource-based URI
Appropriate Headers
Response (404 NOT FOUND):
{"status": "NOT_FOUND”,"header": {
"headerAttributes": {}},"errors": [
{"code": "404.LOOKUP_SERVICE.1001","field": "”,"description": "Item details not found.","info": "","severity": "ERROR","category": "REQUEST","causes": [],"errorIdentifiers": {}
}],"payload": null
}
URI: http://www.hostname.com/path/items/123456
![Page 50: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/50.jpg)
Richardson Maturity Model – Level 2
Response (200 OK):
{"payload": {
"item": {"itemName": "FRONTLINE LARGE DOG","upc": "0000350604287200","multiPackStatus": false,
"hazMat": false,"hazwaste": false,...
},"supplier": {...}
}}
URI: http://www.hostname.com/path/items/123456
Request (GET):
No Request Body
Resource-based URI
Appropriate Headers
![Page 51: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/51.jpg)
Richardson Maturity Model – Level 2
• At level two, you are satisfying up to 5½ of the 6 constraints
• For internal-use ReST, often hit point of diminishing returns past level 2
![Page 52: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/52.jpg)
Richardson Maturity Model – Level 3
•HATEOAS: Hypertext As The Engine Of Application State
• The responses document the API itself
•Makes it easier to change the API without impacting clients
![Page 53: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/53.jpg)
Richardson Maturity Model – Level 3
GET Response:
{"payload": [
{"upc": "0000350604287200",...,"details": "/items/123456"
},{
"upc": "0000681131159430",...,"details": "/items/789012"
},...
]}
GET Response:
{"payload": {
"item": {"itemName": "FRONTLINE LARGE DOG","upc": "0000350604287200","multiPackStatus": false,
"hazMat": false,"hazwaste": false,...
},"supplier": "/suppliers/123456"
}}
URI: http://www.hostname.com/path/items URI: http://www.hostname.com/path/items/123456
![Page 54: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/54.jpg)
Richardson Maturity Model – Level 3
Credit:LisaFrank
![Page 55: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/55.jpg)
Assumptions & BaselineReST TheoryReST in the WildSo What?
Talking Points
01020304
![Page 56: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/56.jpg)
Ask yourself
•Why am I building this API?
•Where are the capability boundaries?
•Who might my consumers be?
![Page 57: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/57.jpg)
What happens when…
• You aren’t right-sized and cohesive?
• Are you violating the:• Client-Server Architecture constraint?• Layered System constraint?
![Page 58: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/58.jpg)
What happens when…
• You aren’t resource-driven?
• Are your URIs resources?• Are your responses stateless
representations?
![Page 59: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/59.jpg)
What happens when…
• You don’t leverage HTTP standards?
•How easy is your API to• Consume?• Cache?• Change?
![Page 60: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/60.jpg)
“”To succeed in this world, you have to change all the time.
Sam Walton, Walmart Founder
![Page 61: Mike Carey –ReSTDone Right - agiledaytwincities.orgagiledaytwincities.org/wp-content/uploads/2017/11/Mike-Carey-ReST.pdf · •Provides greater flexibility than SOAP, other protocols](https://reader033.vdocuments.us/reader033/viewer/2022042605/5aad6c0a7f8b9a2e088e2bfc/html5/thumbnails/61.jpg)