SlideShare a Scribd company logo
1 of 35
Download to read offline
2015Vladimir Tsukur @ Java Day Lviv
From CRUD to
Hypermedia APIs
with
REST
Vladimir Tsukur
partner @
team lead @
principal
engineer @
flushdia vtsukur
Web API? Why Should I Care?
Idea! Currency Black
Market!
5
finance.i.ua - Listing
finance.i.ua - Ad Creation
Spring Boot
Tools
Spring Data
Spring Data REST
CODING TIME !
10
Method URL Task
POST /ads Create new ad
GET /ads View ads
GET /ads/{id} Get ad
PATCH / PUT /ads/{id} Update ad
DELETE /ads/{id} Delete ad
CRUD Style API
I am sorry, but
we have business
process!
CRUD is NOT enough
if (status == Status.NEW) {
publishedAt = LocalDateTime.now();
status = Status.PUBLISHED;
} …
13
Method URL Task
POST /ads/{id}/publishing Publish ad
POST /ads/{id}/expiration Expire ad
GET /ads/search/published Get published ads
API Changes
CODING TIME !
/uri Style Adoption?
43%
16
17
Task Method URL
Update ad PATCH /ads/{id}
Delete ad DELETE /ads/{id}
Publish ad POST /ads/{id}/publishing
Expire ad POST /ads/{id}/expiration
URI Binding & Construction
18
Task Method URL
Update ad
(only if NEW) PATCH /ads/{id}
Delete ad
(only if NEW) DELETE /ads/{id}
Publish ad
(only if NEW) POST /ads/{id}/publishing
Expire ad
(only if
PUBLISHED)
POST /ads/{id}/expiration
"Figuring" Out the Flow
Should work on my
iPhone!
"Hypermedia" =
{
"amount": 3000,
"currency": "USD",
…
}
data
{
…
"_links": {
"publishing": {
"href": "/ads/1/publishing"
},
"update": {
"href": "/ads/1"
},
"deletion": {
"href": "/ads/1"
}
}
}
links
+
22
Link Relation Task Method
update Update ad PATCH
deletion Delete ad DELETE
publishing Publish ad POST
expiration Expire ad POST
Hypermedia API
Spring HATEOAS
Tools
CODING TIME !
Hypertext Application Language
"actions": [
{
"name": "create-ad",
"method": "POST",
"href": "/ads",
"type": "application/json",
"fields": [
{ "name": "type", "type": "radio" },
{ "name": "quantity", "type": "number" },
{ "name": "currency", "type": "radio" },
…
]
}
]
Siren Actions
"I want hypermedia!"
40%
Testing?
Documentation?
30
Spring REST Docs!
Outcomes -
1. Spring Data REST - simple, CRUD-y
and HATEOAS-y; extensible
PRO TIP: won't solve everything
2. Spring MVC - always there to help
3. Link stuff with Spring HATEOAS
4. Document with Spring REST Docs
Project @
https://github.com/vtsukur/spring-rest-black-market
33
Thanks!
Questions?
References
1. http://www.google.com.ua/trends/explore#q=web%20api%2C%20rest%20api&cmpt=q&tz=
2. http://finance.i.ua/market/
3. http://projects.spring.io/spring-boot/
4. http://projects.spring.io/spring-data/
5. http://docs.spring.io/spring-data/jpa/docs/1.7.2.RELEASE/reference/html/
6. http://projects.spring.io/spring-data-rest/
7. http://docs.spring.io/spring-data/rest/docs/2.3.0.RELEASE/reference/html/
8. https://spring.io/blog/2014/07/14/spring-data-rest-now-comes-with-alps-metadata
9. http://projects.spring.io/spring-hateoas/
10. http://docs.spring.io/spring-hateoas/docs/0.17.0.RELEASE/reference/html/
11. https://github.com/spring-projects/spring-restdocs
12. https://blog.akana.com/hypermedia-apis
13. http://www.apiacademy.co/lessons/api-design/web-api-architectural-styles
14. http://www.programmableweb.com/news/modern-api-architectural-styles-offer-developers-choices/2014/06/13
15. https://en.wikipedia.org/wiki/Hypermedia
16. http://stateless.co/hal_specification.html
17. https://github.com/kevinswiber/siren
18. https://www.mnot.net/blog/2013/06/23/linking_apis
19. http://oredev.org/2010/sessions/hypermedia-apis
20. http://vimeo.com/75106815
21. https://www.innoq.com/blog/st/2012/06/hypermedia-benefits-for-m2m-communication/
22. http://ws-rest.org/2014/sites/default/files/wsrest2014_submission_12.pdf
23. http://www.infoq.com/news/2014/03/ca-api-survey
24. https://twitter.com/hypermediaapis
25. https://www.youtube.com/watch?v=hdSrT4yjS1g
26. https://www.youtube.com/watch?v=mZ8_QgJ5mbs
27. http://nordsc.com/ext/classification_of_http_based_apis.html
28. http://soabits.blogspot.no/2013/12/selling-benefits-of-hypermedia.html
29. https://github.com/mamund/Building-Hypermedia-APIs
30. http://tech.blog.box.com/2013/04/get-developer-hugs-with-rich-error-handling-in-your-api/
Images
1. http://i.ytimg.com/vi/HUSSKWWg-0c/maxresdefault.jpg
2. http://www.2000.ua/modules/pages/upload/images/25(55).jpg
3. http://gordonua.com/img/forall/users/33/3332/2m.jpg
4. http://spring.io/img/iconsprite.png
5. http://nisostech.com/wp-content/uploads/2015/05/spring-by-pivotal.png
6. http://www.globallogic.com/wp-content/uploads/2013/12/GlobalLogic-Logo-Gray.png
7. http://easyhunt.com/static/images/easyhunt_logo.png
8. http://www.avid.com/iwov-resources/images/avid_logo.png
9. https://upload.wikimedia.org/wikipedia/commons/a/a4/Java_logo_and_wordmark.svg
10. http://ericdye.it/wp-content/uploads/2015/03/Challenge-Accepted-Meme.jpg
11. https://community.emc.com/servlet/JiveServlet/showImage/102-38392-2-112371/layer7-logo.png
12. http://docs.akana.com/style/images/formerlyLOGO8.png
13. http://demotivators.to/media/posters/2228/119881_znanie.jpg
14. http://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/HTTP_logo.svg/1280px-HTTP_logo.svg.png
15. http://vignette4.wikia.nocookie.net/sims/images/c/cc/Android_logo.png/revision/latest?cb=20140625060410&path-prefix=ru
16. http://vignette3.wikia.nocookie.net/dominations/images/b/b2/IOS_Logo.jpg/revision/latest?cb=20150115085622
17. http://livepcconnect.com/BROWSERHELPBLOG.COM/wp-content/uploads/2015/04/browsericons.png
18. http://support.app-global.ru/img/kb/IDX_PayPal_updating/api.png
19. http://stateless.co/info-model.png
20. https://seattle.wordcamp.org/2013/files/2013/04/foxycart-logo-8in.png
21. http://mms.businesswire.com/media/20131014006192/en/387170/5/FamilySearchLogo_highres.jpg
22. http://www.v3.co.uk/IMG/333/208333/huddle-logo.jpg
23. http://www.revive-adserver.com/media/GitHub.jpg
24. https://s3.amazonaws.com/kinlane-productions/api-evangelist/lync/lync-web-developer-logo.png
25. https://www.paypalobjects.com/webstatic/developer/logo2_paypal_developer_1x.png
26. http://developers.verticalresponse.com/public/Mashery/images/clients/verticalresponse/logo.png
27. http://www.seek.co.nz/templates/25584556_1a_logo.png
28. http://upload.wikimedia.org/wikipedia/commons/thumb/8/87/Op3nVoice_Logo_1.png/220px-Op3nVoice_Logo_1.png
29. http://blogs.it.ox.ac.uk/adamweblearn/files/2010/09/mox-apps.jpg
30. http://blink.ucsd.edu/_images/technology-tab/aws.jpg

More Related Content

What's hot

Building Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreBuilding Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreStormpath
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service designRamin Orujov
 
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...GoogleTecTalks
 
The REST And Then Some
The REST And Then SomeThe REST And Then Some
The REST And Then SomeNordic APIs
 
[DevCrowd] GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za mało[DevCrowd] GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za małoMarcinStachniuk
 
GraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoGraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoMarcinStachniuk
 
How to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet apiHow to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet apiE Boisgontier
 
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedBruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedMarcinStachniuk
 
How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019Paul Shapiro
 
Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Matteo Collina
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsTessa Mero
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
 
Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)
Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)
Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)Shift Conference
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...CA API Management
 

What's hot (14)

Building Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreBuilding Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET Core
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service design
 
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
 
The REST And Then Some
The REST And Then SomeThe REST And Then Some
The REST And Then Some
 
[DevCrowd] GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za mało[DevCrowd] GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za mało
 
GraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoGraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za mało
 
How to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet apiHow to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet api
 
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedBruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
 
How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019
 
Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)
Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)
Shift AI 2020: Don't type your passwords, speak! | Ishan Jain (Microsoft)
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
 

Viewers also liked

SOA & APIs: Fearless Lessons from the Field
 SOA & APIs: Fearless Lessons from the Field SOA & APIs: Fearless Lessons from the Field
SOA & APIs: Fearless Lessons from the FieldCA API Management
 
Standardizing Our Drivers Through Specifications: A Look at the CRUD API
Standardizing Our Drivers Through Specifications: A Look at the CRUD APIStandardizing Our Drivers Through Specifications: A Look at the CRUD API
Standardizing Our Drivers Through Specifications: A Look at the CRUD APIMongoDB
 
rest without put
rest without putrest without put
rest without putXiaojun REN
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEreneechemel
 
Web api crud operations
Web api crud operationsWeb api crud operations
Web api crud operationsEyal Vardi
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni InturiSreeni I
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web ServicesAngelin R
 

Viewers also liked (10)

Cqrs api
Cqrs apiCqrs api
Cqrs api
 
SOA & APIs: Fearless Lessons from the Field
 SOA & APIs: Fearless Lessons from the Field SOA & APIs: Fearless Lessons from the Field
SOA & APIs: Fearless Lessons from the Field
 
Standardizing Our Drivers Through Specifications: A Look at the CRUD API
Standardizing Our Drivers Through Specifications: A Look at the CRUD APIStandardizing Our Drivers Through Specifications: A Look at the CRUD API
Standardizing Our Drivers Through Specifications: A Look at the CRUD API
 
rest without put
rest without putrest without put
rest without put
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
 
Web api crud operations
Web api crud operationsWeb api crud operations
Web api crud operations
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
REST beyond CRUD
REST beyond CRUDREST beyond CRUD
REST beyond CRUD
 

Similar to From CRUD to Hypermedia APIs with Spring

Creating Professional Applications with the LinkedIn API
Creating Professional Applications with the LinkedIn APICreating Professional Applications with the LinkedIn API
Creating Professional Applications with the LinkedIn APIKirsten Hunter
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Tech Community
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Tech Community
 
Great APIs - Future of Your Progress App
Great APIs - Future of Your Progress AppGreat APIs - Future of Your Progress App
Great APIs - Future of Your Progress AppGabriel Lucaciu
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical WritingSarah Maddox
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsTom Johnson
 
How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...CALLR
 
Hi5 Hackathon Presentation
Hi5 Hackathon PresentationHi5 Hackathon Presentation
Hi5 Hackathon PresentationLou Moore
 
Startup Safary | Fight against robots with enbrite.ly data platform
Startup Safary | Fight against robots with enbrite.ly data platformStartup Safary | Fight against robots with enbrite.ly data platform
Startup Safary | Fight against robots with enbrite.ly data platformMészáros József
 
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...Rob Tweed
 
Bootstrapping an App for Launch
Bootstrapping an App for LaunchBootstrapping an App for Launch
Bootstrapping an App for LaunchCraig Phares
 
Using a hypermedia API with Angular.js
Using a hypermedia API with Angular.jsUsing a hypermedia API with Angular.js
Using a hypermedia API with Angular.jsPieter Herroelen
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Mario Cardinal
 
Introduction to REST and Hypermedia
Introduction to REST and HypermediaIntroduction to REST and Hypermedia
Introduction to REST and HypermediaNordic APIs
 
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!Evan Mullins
 

Similar to From CRUD to Hypermedia APIs with Spring (20)

Creating Professional Applications with the LinkedIn API
Creating Professional Applications with the LinkedIn APICreating Professional Applications with the LinkedIn API
Creating Professional Applications with the LinkedIn API
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needs
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needs
 
Great APIs - Future of Your Progress App
Great APIs - Future of Your Progress AppGreat APIs - Future of Your Progress App
Great APIs - Future of Your Progress App
 
Rest API's
Rest API'sRest API's
Rest API's
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
 
How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...
 
Greeshma-Resume
Greeshma-ResumeGreeshma-Resume
Greeshma-Resume
 
Hi5 Hackathon Presentation
Hi5 Hackathon PresentationHi5 Hackathon Presentation
Hi5 Hackathon Presentation
 
Digital Marketing Mumbai
Digital Marketing MumbaiDigital Marketing Mumbai
Digital Marketing Mumbai
 
Startup Safary | Fight against robots with enbrite.ly data platform
Startup Safary | Fight against robots with enbrite.ly data platformStartup Safary | Fight against robots with enbrite.ly data platform
Startup Safary | Fight against robots with enbrite.ly data platform
 
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
 
Bootstrapping an App for Launch
Bootstrapping an App for LaunchBootstrapping an App for Launch
Bootstrapping an App for Launch
 
Using a hypermedia API with Angular.js
Using a hypermedia API with Angular.jsUsing a hypermedia API with Angular.js
Using a hypermedia API with Angular.js
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
Building Valuable RESTful APIs
Building Valuable RESTful APIsBuilding Valuable RESTful APIs
Building Valuable RESTful APIs
 
Introduction to REST and Hypermedia
Introduction to REST and HypermediaIntroduction to REST and Hypermedia
Introduction to REST and Hypermedia
 
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
 

More from Vladimir Tsukur

GraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaGraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaVladimir Tsukur
 
GraphQL - APIs The New Way
GraphQL - APIs The New WayGraphQL - APIs The New Way
GraphQL - APIs The New WayVladimir Tsukur
 
Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!Vladimir Tsukur
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaVladimir Tsukur
 
Law of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of StyleLaw of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of StyleVladimir Tsukur
 
Abstraction Classes in Software Design
Abstraction Classes in Software DesignAbstraction Classes in Software Design
Abstraction Classes in Software DesignVladimir Tsukur
 
Acceptance Testing of Web UI
Acceptance Testing of Web UIAcceptance Testing of Web UI
Acceptance Testing of Web UIVladimir Tsukur
 
REpresentational State Transfer
REpresentational State TransferREpresentational State Transfer
REpresentational State TransferVladimir Tsukur
 

More from Vladimir Tsukur (9)

GraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaGraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with Sangria
 
GraphQL - APIs The New Way
GraphQL - APIs The New WayGraphQL - APIs The New Way
GraphQL - APIs The New Way
 
Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with Hypermedia
 
Take a REST!
Take a REST!Take a REST!
Take a REST!
 
Law of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of StyleLaw of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of Style
 
Abstraction Classes in Software Design
Abstraction Classes in Software DesignAbstraction Classes in Software Design
Abstraction Classes in Software Design
 
Acceptance Testing of Web UI
Acceptance Testing of Web UIAcceptance Testing of Web UI
Acceptance Testing of Web UI
 
REpresentational State Transfer
REpresentational State TransferREpresentational State Transfer
REpresentational State Transfer
 

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

From CRUD to Hypermedia APIs with Spring

  • 1. 2015Vladimir Tsukur @ Java Day Lviv From CRUD to Hypermedia APIs with
  • 2. REST Vladimir Tsukur partner @ team lead @ principal engineer @ flushdia vtsukur
  • 3. Web API? Why Should I Care?
  • 7.
  • 10. 10 Method URL Task POST /ads Create new ad GET /ads View ads GET /ads/{id} Get ad PATCH / PUT /ads/{id} Update ad DELETE /ads/{id} Delete ad CRUD Style API
  • 11. I am sorry, but we have business process!
  • 12. CRUD is NOT enough if (status == Status.NEW) { publishedAt = LocalDateTime.now(); status = Status.PUBLISHED; } …
  • 13. 13 Method URL Task POST /ads/{id}/publishing Publish ad POST /ads/{id}/expiration Expire ad GET /ads/search/published Get published ads API Changes
  • 16. 16
  • 17. 17 Task Method URL Update ad PATCH /ads/{id} Delete ad DELETE /ads/{id} Publish ad POST /ads/{id}/publishing Expire ad POST /ads/{id}/expiration URI Binding & Construction
  • 18. 18 Task Method URL Update ad (only if NEW) PATCH /ads/{id} Delete ad (only if NEW) DELETE /ads/{id} Publish ad (only if NEW) POST /ads/{id}/publishing Expire ad (only if PUBLISHED) POST /ads/{id}/expiration "Figuring" Out the Flow
  • 19. Should work on my iPhone!
  • 20.
  • 21. "Hypermedia" = { "amount": 3000, "currency": "USD", … } data { … "_links": { "publishing": { "href": "/ads/1/publishing" }, "update": { "href": "/ads/1" }, "deletion": { "href": "/ads/1" } } } links +
  • 22. 22 Link Relation Task Method update Update ad PATCH deletion Delete ad DELETE publishing Publish ad POST expiration Expire ad POST Hypermedia API
  • 26. "actions": [ { "name": "create-ad", "method": "POST", "href": "/ads", "type": "application/json", "fields": [ { "name": "type", "type": "radio" }, { "name": "quantity", "type": "number" }, { "name": "currency", "type": "radio" }, … ] } ] Siren Actions
  • 28.
  • 31. Outcomes - 1. Spring Data REST - simple, CRUD-y and HATEOAS-y; extensible PRO TIP: won't solve everything 2. Spring MVC - always there to help 3. Link stuff with Spring HATEOAS 4. Document with Spring REST Docs
  • 34. References 1. http://www.google.com.ua/trends/explore#q=web%20api%2C%20rest%20api&cmpt=q&tz= 2. http://finance.i.ua/market/ 3. http://projects.spring.io/spring-boot/ 4. http://projects.spring.io/spring-data/ 5. http://docs.spring.io/spring-data/jpa/docs/1.7.2.RELEASE/reference/html/ 6. http://projects.spring.io/spring-data-rest/ 7. http://docs.spring.io/spring-data/rest/docs/2.3.0.RELEASE/reference/html/ 8. https://spring.io/blog/2014/07/14/spring-data-rest-now-comes-with-alps-metadata 9. http://projects.spring.io/spring-hateoas/ 10. http://docs.spring.io/spring-hateoas/docs/0.17.0.RELEASE/reference/html/ 11. https://github.com/spring-projects/spring-restdocs 12. https://blog.akana.com/hypermedia-apis 13. http://www.apiacademy.co/lessons/api-design/web-api-architectural-styles 14. http://www.programmableweb.com/news/modern-api-architectural-styles-offer-developers-choices/2014/06/13 15. https://en.wikipedia.org/wiki/Hypermedia 16. http://stateless.co/hal_specification.html 17. https://github.com/kevinswiber/siren 18. https://www.mnot.net/blog/2013/06/23/linking_apis 19. http://oredev.org/2010/sessions/hypermedia-apis 20. http://vimeo.com/75106815 21. https://www.innoq.com/blog/st/2012/06/hypermedia-benefits-for-m2m-communication/ 22. http://ws-rest.org/2014/sites/default/files/wsrest2014_submission_12.pdf 23. http://www.infoq.com/news/2014/03/ca-api-survey 24. https://twitter.com/hypermediaapis 25. https://www.youtube.com/watch?v=hdSrT4yjS1g 26. https://www.youtube.com/watch?v=mZ8_QgJ5mbs 27. http://nordsc.com/ext/classification_of_http_based_apis.html 28. http://soabits.blogspot.no/2013/12/selling-benefits-of-hypermedia.html 29. https://github.com/mamund/Building-Hypermedia-APIs 30. http://tech.blog.box.com/2013/04/get-developer-hugs-with-rich-error-handling-in-your-api/
  • 35. Images 1. http://i.ytimg.com/vi/HUSSKWWg-0c/maxresdefault.jpg 2. http://www.2000.ua/modules/pages/upload/images/25(55).jpg 3. http://gordonua.com/img/forall/users/33/3332/2m.jpg 4. http://spring.io/img/iconsprite.png 5. http://nisostech.com/wp-content/uploads/2015/05/spring-by-pivotal.png 6. http://www.globallogic.com/wp-content/uploads/2013/12/GlobalLogic-Logo-Gray.png 7. http://easyhunt.com/static/images/easyhunt_logo.png 8. http://www.avid.com/iwov-resources/images/avid_logo.png 9. https://upload.wikimedia.org/wikipedia/commons/a/a4/Java_logo_and_wordmark.svg 10. http://ericdye.it/wp-content/uploads/2015/03/Challenge-Accepted-Meme.jpg 11. https://community.emc.com/servlet/JiveServlet/showImage/102-38392-2-112371/layer7-logo.png 12. http://docs.akana.com/style/images/formerlyLOGO8.png 13. http://demotivators.to/media/posters/2228/119881_znanie.jpg 14. http://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/HTTP_logo.svg/1280px-HTTP_logo.svg.png 15. http://vignette4.wikia.nocookie.net/sims/images/c/cc/Android_logo.png/revision/latest?cb=20140625060410&path-prefix=ru 16. http://vignette3.wikia.nocookie.net/dominations/images/b/b2/IOS_Logo.jpg/revision/latest?cb=20150115085622 17. http://livepcconnect.com/BROWSERHELPBLOG.COM/wp-content/uploads/2015/04/browsericons.png 18. http://support.app-global.ru/img/kb/IDX_PayPal_updating/api.png 19. http://stateless.co/info-model.png 20. https://seattle.wordcamp.org/2013/files/2013/04/foxycart-logo-8in.png 21. http://mms.businesswire.com/media/20131014006192/en/387170/5/FamilySearchLogo_highres.jpg 22. http://www.v3.co.uk/IMG/333/208333/huddle-logo.jpg 23. http://www.revive-adserver.com/media/GitHub.jpg 24. https://s3.amazonaws.com/kinlane-productions/api-evangelist/lync/lync-web-developer-logo.png 25. https://www.paypalobjects.com/webstatic/developer/logo2_paypal_developer_1x.png 26. http://developers.verticalresponse.com/public/Mashery/images/clients/verticalresponse/logo.png 27. http://www.seek.co.nz/templates/25584556_1a_logo.png 28. http://upload.wikimedia.org/wikipedia/commons/thumb/8/87/Op3nVoice_Logo_1.png/220px-Op3nVoice_Logo_1.png 29. http://blogs.it.ox.ac.uk/adamweblearn/files/2010/09/mox-apps.jpg 30. http://blink.ucsd.edu/_images/technology-tab/aws.jpg