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
HTTP API Design for iOS Applications
Search
Patrick Van Stee
August 16, 2013
Programming
11
580
HTTP API Design for iOS Applications
Patrick Van Stee
August 16, 2013
Tweet
Share
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
137
6.8k
Elixir and Ecto
vanstee
5
880
Bootstrap
vanstee
8
750
Consensus: An Introduction to Raft
vanstee
22
2.9k
Convergent Replicated Data Types
vanstee
4
710
Pour Over Brewing Method
vanstee
1
320
Celluloid & DCell
vanstee
4
520
Map Reduce & Ruby
vanstee
10
750
Other Decks in Programming
See All in Programming
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
120
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
230
DROBEの生成AI活用事例 with AWS
ippey
0
130
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
340
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
300
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
270
【PHP】破壊的バージョンアップと戦った話〜決断と説得
satoshi256kbyte
0
120
WebDriver BiDiとは何なのか
yotahada3
1
140
Software Architecture
hschwentner
6
2.1k
[Fin-JAWS 第38回 ~re:Invent 2024 金融re:Cap~]FaultInjectionServiceアップデート@pre:Invent2024
shintaro_fukatsu
0
400
ペアーズでの、Langfuseを中心とした評価ドリブンなリリースサイクルのご紹介
fukubaka0825
2
300
Conform を推す - Advocating for Conform
mizoguchicoji
3
680
Featured
See All Featured
KATA
mclloyd
29
14k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
How STYLIGHT went responsive
nonsquared
98
5.3k
Designing for humans not robots
tammielis
250
25k
The Cult of Friendly URLs
andyhume
78
6.2k
GitHub's CSS Performance
jonrohan
1030
460k
The Invisible Side of Design
smashingmag
299
50k
Designing Experiences People Love
moore
139
23k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Faster Mobile Websites
deanohume
306
31k
Unsuck your backbone
ammeep
669
57k
Typedesign – Prime Four
hannesfritz
40
2.5k
Transcript
HTTP API Design for iOS Applications
@vanstee Big Nerd Ranch
• Modeling Resources • Tools: Server and Client • Real
world problems • Future
Modeling Resources
The key abstraction of information in REST is a resource.
re·source /ˈrēˌsôrs/ A resource is a conceptual mapping to a
set of entities, not the entity that corresponds to the mapping at any particular point in time.
Resources are not just database records
Resources are the nouns. HTTP methods are the verbs. URIs
are the identifiers. Media types are the representations.
But what about transactions? searches? complex actions?
Don’t do this: POST /accounts/1/transfer/500.00/to/2 Try this instead: POST /transactions
{ “from”: 1, “to”: 2, “amount”: 500.00 }
Tools
Server-side • Rails • Active Model Serializers • Custom Responders
• rack-test and json_spec
Client-side • AFNetworking • RestKit (if you really need it)
• VCRURLConnection and mitmproxy
Real World Problems
Versioning Don’t do this: POST /v1/users/1 Try this instead: POST
/users/1 Accept: application/json; version=1.0
Authentication • OAuth2 with API routes for token generation •
NSURLConnection supports cookies • Basic Authentication over HTTPS*
Caching • NSURLCache has support for Cache-Control and ETags •
AFNetworking supports this by default • Rails gives you these for free
Smarter Requests • Side loading associated resources • HTTP Pipelining
for GET, HEAD, PUT, and DELETE requests • HTTP compression
Future
HTTP 2.0 • Based on SPDY • Multiplexing • Server
Push • Better compression
JSON API • Standard hypermedia type • Always namespaced •
Always returns collections for easy parsing • Support for batch operations
JSON Patch • Standard hypermedia type for updating records •
Easily handle associations • Send minimal amount of information
Thanks blog.steveklabnik.com designinghypermediaapis.com afnetworking.com jsonapi.org