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
540
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
136
6.6k
Elixir and Ecto
vanstee
5
820
Bootstrap
vanstee
8
710
Consensus: An Introduction to Raft
vanstee
22
2.8k
Convergent Replicated Data Types
vanstee
4
670
Pour Over Brewing Method
vanstee
1
290
Celluloid & DCell
vanstee
4
470
Map Reduce & Ruby
vanstee
10
700
Other Decks in Programming
See All in Programming
文化が生産性を作る
jimpei
3
570
XP2024 っていう国際会議に行ってきたよの記
bonotake
4
240
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
150
Cohesion in Modeling and Design
mploed
3
210
C#および.NETに対する誤解をひも解く
ymd65536
0
290
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
1.2k
NEWTにおけるiOS18対応の進め方
ryu1sazae
0
240
4年間変わらなかった YOUTRUSTのアーキテクチャ
daiki1003
1
630
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
6
710
Re:PandasAI:生成AIがデータ分析業務にもたらすパラダイムシフト【増補改訂版】
negi111111
1
1.1k
Competitionsだけじゃない! Kaggle Notebooks Grandmasterのすすめ
corochann
2
500
What is TDD?
urakawa_jinsei
1
220
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
Debugging Ruby Performance
tmm1
73
12k
Designing for humans not robots
tammielis
249
25k
Statistics for Hackers
jakevdp
796
220k
Into the Great Unknown - MozCon
thekraken
31
1.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
4
120
Docker and Python
trallard
40
3k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
The Invisible Customer
myddelton
119
13k
Unsuck your backbone
ammeep
668
57k
Building Applications with DynamoDB
mza
90
6k
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