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
500
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
133
6.3k
Elixir and Ecto
vanstee
5
730
Bootstrap
vanstee
8
670
Consensus: An Introduction to Raft
vanstee
22
2.6k
Convergent Replicated Data Types
vanstee
4
600
Pour Over Brewing Method
vanstee
1
250
Celluloid & DCell
vanstee
4
410
Map Reduce & Ruby
vanstee
10
620
Other Decks in Programming
See All in Programming
Goのエラースタックトレースの歴史と今後
sonatard
10
1.8k
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
900
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
雑に思考を整理する技術と効能
konifar
63
30k
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
450
SIMD Parallel Programming with the Vector API
josepaumard
0
230
Exploring the Implementation of “t.Run”, “t.Parallel”, and “t.Cleanup”
akarin
1
110
Ruby Function Composition
bkuhlmann
1
340
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
170
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
460
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
500
禅の心を手に入れよ
eltociear
1
290
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
GraphQLの誤解/rethinking-graphql
sonatard
55
9.3k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
The Brand Is Dead. Long Live the Brand.
mthomps
49
29k
Automating Front-end Workflow
addyosmani
1357
200k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
21
1.4k
Designing for Performance
lara
602
67k
Fireside Chat
paigeccino
22
2.6k
A Tale of Four Properties
chriscoyier
152
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
39
2.5k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
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