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
47
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
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
230
202512_AIoT.pdf
iotcomjpadmin
0
160
松尾研LLM講座2025 応用編Day3「軽量化」 講義資料
aratako
14
4.6k
MySQLのSpatial(GIS)機能をもっと充実させたい ~ MyNA望年会2025LT
sakaik
0
160
AIエージェントを5分で一気におさらい!AIエージェント「構築」元年に備えよう
yakumo
1
120
アラフォーおじさん、はじめてre:Inventに行く / A 40-Something Guy’s First re:Invent Adventure
kaminashi
0
180
AI駆動開発ライフサイクル(AI-DLC)の始め方
ryansbcho79
0
240
BidiAgent と Nova 2 Sonic から考える音声 AI について
yama3133
2
120
20251203_AIxIoTビジネス共創ラボ_第4回勉強会_BP山崎.pdf
iotcomjpadmin
0
150
Next.js 16の新機能 Cache Components について
sutetotanuki
0
200
20251219 OpenIDファウンデーション・ジャパン紹介 / OpenID Foundation Japan Intro
oidfj
0
570
Identity Management for Agentic AI 解説
fujie
0
550
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
9
35k
Accessibility Awareness
sabderemane
0
26
Building AI with AI
inesmontani
PRO
1
590
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
92
Optimising Largest Contentful Paint
csswizardry
37
3.5k
The Spectacular Lies of Maps
axbom
PRO
1
400
sira's awesome portfolio website redesign presentation
elsirapls
0
94
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
34
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Pragmatic Product Professional
lauravandoore
37
7.1k
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