Design & Deploy a data-driven Web API in 2 hours
-
Upload
restlet -
Category
Technology
-
view
1.740 -
download
2
description
Transcript of Design & Deploy a data-driven Web API in 2 hours
![Page 1: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/1.jpg)
DESIGN & DEPLOYA DATA-DRIVEN API IN 2 HOURS
All-in-one platform for Web APIshttp://apispark.com
October 23, 2013
Restlet undersigned this GigaOMresearch report, written by Kin Lane
![Page 2: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/2.jpg)
PRESENTERENTREPRENEUR AND WEB API EXPERT
Jérôme LOUVEL CEO of Restlet
12 years of experience in software (EU and US)
Restlet Framework creator (2005)
JAX-RS 1.0 expert (JSR-311)
Contributor to “RESTful Web Services” (O’Reilly)
Co-author of “Restlet in Action” (Manning)
Contact
Twitter : @jlouvel and Google+
Blog : blog.restlet.com
![Page 3: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/3.jpg)
AGENDA
Part 1 – API design– Info: The ROA/D to API design
– Lab: Specify your Pizza API
Pause
Part 2 – API deployment– Info: APISpark as an IDE and runtime
– Lab: Deploy your Pizza API
![Page 4: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/4.jpg)
PART 1 - API DESIGN (15’)
Info : The ROA/D to API design
![Page 5: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/5.jpg)
HOW TO DESIGN MY API?
Let’s pick up a web API framework and prototype!
I’ll read and digest REST dissertation first
APIs are lighter Web Services, nothing new
Let’s look at popular APIs and follow best practices
My API should have nice URIs and CRUD methods
Which kind of design process should I follow?
Many ways to tackle this…
![Page 6: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/6.jpg)
METHODOLOGY
Resource-Oriented Analysis & Design
– Based on our consulting experience at Restlet
– Variant of OOA/D described in « Restlet in Action » book
– Usable on Agile projects and with Lean approaches
Learn about the ROA/D methodology !
![Page 7: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/7.jpg)
ITERATION STEPS
Requirements gathering
Requirements analysis
Solutiondesign
Designimplementation
Implementationtesting
![Page 8: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/8.jpg)
PROJECT PHASES
Inception Elaboration Construction Transition
Each phase contains– Several iterations
– More requirements & analysis in early phases
– More implementation & testing in later phases
![Page 9: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/9.jpg)
&
UX Design for API Developers
• UX != UI UXD != API
• Similar process:– User research Persona Use case Feature(s)
• Enrich ROA/D during– Requirements
– Analysis
• Based on Nazmul and Izabel Idrisworkshop for Google I/O 13– http://bit.ly/uxcommunity
– Adapted to web APIs byAPISpark with help of SFEIR
Requirements gathering
Requirementsanalysis
![Page 10: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/10.jpg)
DESCRIBE API PERSONAS
• Bart is a Mobile app developer– Unreliable networks– Pre-fetch and cache data – Small data packets best– Android first, then iPhone
• Homer is a HTML 5 developer– Good connectivity– Bigger data for larger screens– Same-Origin Policy– Works with AngularJS
• Contextual and specific to your API
• Don’t denature a persona
• Don’t support too many personas
• Think about gameconsoles, connectedTV / cars, glue scripts
Advises
![Page 11: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/11.jpg)
DESCRIBE API FEATURES
• Use cases for Bart
– Build an iPad app version
– Build an Android app version
– Build an iPhone app version
• Features
– Provide an iOS client SDK
– Provide an Android client SDK
– Supported GZip HTTP
– Monitor API traffic per mobile device type
• Identify use cases per persona
• Derive features from concrete use cases
• Be careful about feature creep!
Advises
![Page 12: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/12.jpg)
BALANCE API FEATURESSIMPLICITY VS CAPABILITY
Complexity
Capability
Simplistic and
frustrating
Powerful but
unusable
Adding
features
Adding
features
Good UX
design
Bad UX
design
Your web APIsweet spot
![Page 13: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/13.jpg)
Requirements analysis
Solutiondesign
&
Domain-Driven Design for API Developers
• When your domain isn’t trivial
• Key building blocks– Entity
– Service
– Repository
• Enrich ROA/D during– Analysis
– Design
• Based on Eric Evans book
![Page 14: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/14.jpg)
IDENTIFY DOMAIN ENTITIES
• Defined by thread of continuity
• Has own identity
• Not defined by its properties (value objects)
AdvisesCustomer
Invoice
Order
?
![Page 15: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/15.jpg)
DESCRIBE DOMAIN ENTITIES
• Describe properties
• Describe relationships
• Use class diagrams
Advises
id : String
name : String
created : Date
modified : Date
Customer
id : String
amount : Integer
iterms : List<InvoiceItem>
modified : Date
Invoice
id : String
amount : Integer
iterms : List<OrderItem>
modified : Date
Order
*
1
*
![Page 16: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/16.jpg)
Requirements analysis
Solutiondesign
Next design steps are more API specific
• Define your logical architecture– Learn about Netflix API strategy
• Derive your domain entities into– API resources
– Domain objects
– Data tables
• Design your API resources– URI templates
– Representations structure
– Supported HTTP methods
![Page 17: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/17.jpg)
UI
API resources
Domain objects
Data tables
_+
Reusable
LOGICAL ARCHITECTURE
![Page 18: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/18.jpg)
DERIVING THE DOMAIN MODEL
Data
tables
ROA/D OOA/D IDEF1
ROM ORM
Domain
entities
Domain
objects
API
resources
![Page 19: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/19.jpg)
IDENTIFY YOUR APIS
• Driven by personas
• Each persona might need a specific API
• All APIs should share the same domain model
Advises
DomainModel
Pages + API
Browser
Connected mobile devices
Smartenvironnement
Partner Internal IS
![Page 20: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/20.jpg)
DESCRIBE API RESOURCES
• Driven by use cases
• Derived from Domain Entities
• Several APIs for on domain model
Advises
Account
{accountId}/
GET() : xml | json | html
PUT(xml | json | form) : xml | json | html
DELETE() : redirect
Accounts
accounts/
GET() : xml | json | html
POST(xml | json | form) : redirect
1
*
Root
http://localhost:8111/
GET() : xml | json | html
1
1
![Page 21: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/21.jpg)
PART 1 - API DESIGN (50’)
Lab : Specify your Pizza API
![Page 22: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/22.jpg)
&
Requirements gathering
Requirementsanalysis
![Page 23: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/23.jpg)
DESCRIBE PIZZA API PERSONAS
• Contextual and specific to your API
• Don’t denature a persona
• Describe a total of 2 personas
• Time limit: 10’
Instructions
![Page 24: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/24.jpg)
DESCRIBE PIZZA API USE CASES
• Put your persona in context with use cases and derive features
• Describe a total of 4 use cases (2 per persona)
• Identify key features
• Time limit: 10’
Instructions
![Page 25: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/25.jpg)
Requirements analysis
Solutiondesign
&
![Page 26: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/26.jpg)
DESCRIBE DOMAIN ENTITIES
• List 4 entities
• Describe their properties
• Including relationships
• Time limit: 10’
Advises
![Page 27: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/27.jpg)
IDENTIFY YOUR APIS
• Driven by personas and features
• Describe 2 endpoints (1 for each API)
• Several APIs should share the same domain model
• Time limit: 5’
Advises
![Page 28: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/28.jpg)
DESCRIBE API RESOURCES
• Driven by use cases
• Derived from Domain Entities
• Single and collection resources
• Time limit: 15’
Advises
![Page 29: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/29.jpg)
Solutiondesign
Design
implementation
Next steps are about API deployment
• Implement the Domain Entities– As a persistent store
• Implement the Resource Model– As a Web API connected to the
Domain Entities
• Choose between DIY and PaaS approaches
![Page 30: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/30.jpg)
TIME FOR A BREAK ! (10’)
![Page 31: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/31.jpg)
PART 2 - API DEPLOYMENT (5’)
Info : APISpark as an IDE and runtime
![Page 32: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/32.jpg)
WEB API PROJECTTYPICAL LIFE CYCLE
Create Host Manage Use Promote
1) Do It Yourself (DIY)
long, risky, expensive but highly flexible
2) Platform as a Service (PaaS)
integrated, fast, cost effective
![Page 33: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/33.jpg)
APISPARK PLATFORMCURRENTLY IN RESTRICTED PUBLIC BETA
Send us your feed-back and help us making it the best PaaS for Web APIs !
![Page 34: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/34.jpg)
COMPOSING APISPARK CELLS
Entity Store File Store
Custom API
Java iOS JS
HTTP HTTP
![Page 35: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/35.jpg)
STRUCTURE OF WEB APIS
API Contract
Implementation
Runtime
Web API
template
Completeweb API
HTTP HTTPS
![Page 36: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/36.jpg)
PART 2 - API DEPLOYMENT (35’)
Lab : Deploy your Pizza API
![Page 37: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/37.jpg)
SOCIAL LOGIN
![Page 38: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/38.jpg)
YOUR DASHBOARD
![Page 39: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/39.jpg)
ENTITY STORE CREATION
![Page 40: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/40.jpg)
ENTITY PROPERTIES
![Page 41: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/41.jpg)
WEB API CREATION
![Page 42: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/42.jpg)
API GENERATION FROM ENTITY STORE
![Page 43: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/43.jpg)
API DEPLOYMENT
![Page 44: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/44.jpg)
CLIENT SDK GENERATION
![Page 45: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/45.jpg)
Designimplementation
Implementationtesting
Next steps are about closing the API loop
• Verify that the API works as expected– Manual tests
– Automated tests
• Functional tests
• Performance tests (availability, latency, throughput, etc.)
• Even more important in case of composite APIs
![Page 46: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/46.jpg)
API TESTING WITH HTTP CLIENT
![Page 47: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/47.jpg)
BUILT-IN ANALYTICS
![Page 48: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/48.jpg)
CONCLUSION
Designing a web API requires thinking
– The UX of developers using your API matters
– Use a minimal but effective process
You can save a lot of time at deployment
– Consider PaaS solutions versus DIY approaches
– Easier and cheaper to get started and maintain
– Think about multiple APIs and versions in 2 years
![Page 49: Design & Deploy a data-driven Web API in 2 hours](https://reader034.fdocuments.us/reader034/viewer/2022051609/54797c58b4af9fa0158b4833/html5/thumbnails/49.jpg)
KEEP IN TOUCH!
http://apispark.com
http://blog.restlet.com
Twitter: @apispark
[email protected] Restlet undersigned this GigaOMresearch report, written by Kin Lane