The document summarizes a presentation about evolving a CRUD API to a hypermedia API. It discusses moving from basic CRUD endpoints to including business logic and hyperlinks in responses to drive the API workflow. Examples show adding links for publishing and expiring ads and evolving responses to include hypermedia links for available actions. The presentation emphasizes implementing this evolution using Spring projects like Spring Data REST, Spring HATEOAS and Spring REST Docs.
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
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
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
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