Designing a Hypermedia API with Grape & Roar
22
Designing a Hypermedia API with {Grape} & Roar Daniel Doubrovkine @dblockdotorg
-
Upload
daniel-doubrovkine -
Category
Technology
-
view
506 -
download
0
description
Given at API Craft NYC, http://www.meetup.com/API-Craft-NYC/events/209294892/
Transcript of Designing a Hypermedia API with Grape & Roar
![Page 1: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/1.jpg)
Designing a Hypermedia API with {Grape} & Roar
Daniel Doubrovkine @dblockdotorg
![Page 2: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/2.jpg)
![Page 3: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/3.jpg)
sale JSON
![Page 4: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/4.jpg)
1K+ cache.delete
![Page 5: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/5.jpg)
![Page 6: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/6.jpg)
GET /api/v1/me/follows
{ _type:* }
![Page 7: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/7.jpg)
GET /api/v1/…
5 years later …
![Page 9: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/9.jpg)
Adopt a standard …
![Page 10: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/10.jpg)
JSON+HALJSONAPI
Collection+JSONSIREN
JSON-LD
![Page 11: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/11.jpg)
1:1 URI:RESOURCEpath?query=string
![Page 12: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/12.jpg)
![Page 13: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/13.jpg)
API RootDiscoverable API
![Page 14: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/14.jpg)
Document
![Page 15: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/15.jpg)
Collections
typed
![Page 16: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/16.jpg)
https://github.com/dblock/grape-with-roarImplement it!
https://github.com/dblock/grape-with-roar-walkthrough
![Page 17: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/17.jpg)
Map 1:1 with Database Fields vs. Relations
![Page 18: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/18.jpg)
Use Version Headers and Media Types
curl 'http://api.artsy.net/api' -H 'Accept:application/vnd.artsy-v2+json'
![Page 19: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/19.jpg)
Make it Flat
![Page 20: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/20.jpg)
Paginate with Offsets, not Pages
![Page 21: Designing a Hypermedia API with Grape & Roar](https://reader034.fdocuments.in/reader034/viewer/2022042714/557d6027d8b42ae1438b4f8a/html5/thumbnails/21.jpg)
Present Everything, Including Errors