Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Building a Better API with JSON:API
Search
Chris Guzman
August 20, 2017
Technology
0
44
Building a Better API with JSON:API
Chris Guzman
August 20, 2017
Tweet
Share
More Decks by Chris Guzman
See All by Chris Guzman
Android libraries I wish I knew when I started
chrisguzman
21
55k
Other Decks in Technology
See All in Technology
LLM時代のパフォーマンスチューニング:MongoDB運用で試したコンテキスト活用の工夫
ishikawa_pro
0
160
EncryptedSharedPreferences が deprecated になっちゃった!どうしよう! / Oh no! EncryptedSharedPreferences has been deprecated! What should I do?
yanzm
0
470
「どこから読む?」コードとカルチャーに最速で馴染むための実践ガイド
zozotech
PRO
0
540
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.8k
Evolución del razonamiento matemático de GPT-4.1 a GPT-5 - Data Aventura Summit 2025 & VSCode DevDays
lauchacarro
0
210
企業の生成AIガバナンスにおけるエージェントとセキュリティ
lycorptech_jp
PRO
2
190
5年目から始める Vue3 サイト改善 #frontendo
tacck
PRO
3
230
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
22
12k
株式会社ログラス - 会社説明資料【エンジニア】/ Loglass Engineer
loglass2019
4
65k
まずはマネコンでちゃちゃっと作ってから、それをCDKにしてみよか。
yamada_r
2
120
大「個人開発サービス」時代に僕たちはどう生きるか
sotarok
20
10k
DroidKaigi 2025 Androidエンジニアとしてのキャリア
mhidaka
2
370
Featured
See All Featured
Navigating Team Friction
lara
189
15k
We Have a Design System, Now What?
morganepeng
53
7.8k
Gamification - CAS2011
davidbonilla
81
5.4k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
How STYLIGHT went responsive
nonsquared
100
5.8k
The World Runs on Bad Software
bkeepers
PRO
70
11k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Transcript
{json:api} A specification for building APIs in JSON
{json:api} A specification for building APIs in JSON duh
None
None
{json:api}
{json:api}
{"json":"api"}
Why?
None
» Minimize requests & data between clients & servers »
Consistency, popular among consultancies » Always backwards compatible » Stable 1.0, not dead
No really
History
!+"+#$+%=
None
Spec
» data: the document’s “primary data” » errors: an array
of error objects » meta: a meta object that contains non-standard meta- information.
Data
{ "data": { "type": "articles", "id": "1", "attributes": { "title":
"Rails is Omakase" }, "relationships": { }, "links": { "self": "http://example.com/articles/1" }, } }
Relationships
{ "relationships": { "author": { "links": { "self": "/articles/1/relationships/author", "related":
"/articles/1/author" }, "data": { "type": "people", "id": "9" } } } }
Meta
{ "meta": { "count": "42", "copyright": "Copyright 2015 Example Corp.",
"authors": [ "Yehuda Katz", "Steve Klabnik", "Dan Gebhardt", "Tyler Kellen" ] } }
Errors
{ "errors": [ "id": "UUID", "status": "418", "code": "42", "title":
"You're a teapot", "detail": "The object is not short nor stout", "links": { "about": "https://httpstatuses.com/418" }, "meta": { "email": "
[email protected]
" } ] }
GET /articles Accept: application/vnd.api+json GET /articles/1 Accept: application/vnd.api+json GET /articles/1/author
Accept: application/vnd.api+json
#Request comments with an article GET /articles/1?include=comments Accept: application/vnd.api+json #Request
comments as well as the author of each of those comments GET /articles/1?include=comments.author Accept: application/vnd.api+json
GET /articles?include=comments,author &fields[people]=first-name,last-name &sort=-date » fetch all articles with their
associated comments and authors » Only be return the first and last names » Sorted by date, most recent first
POST /photos { "data": { "type": "photos", "attributes": { "title":
"Ember Hamster", "src": "http://example.com/images/productivity.png" }, "relationships": { "photographer": { "data": { "type": "people", "id": "9" } } } } }
None
None
None