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
570
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.7k
Elixir and Ecto
vanstee
5
850
Bootstrap
vanstee
8
730
Consensus: An Introduction to Raft
vanstee
22
2.8k
Convergent Replicated Data Types
vanstee
4
690
Pour Over Brewing Method
vanstee
1
310
Celluloid & DCell
vanstee
4
490
Map Reduce & Ruby
vanstee
10
720
Other Decks in Programming
See All in Programming
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
180
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1k
Refactor your code - refactor yourself
xosofox
1
200
Cursorでアプリケーションの追加開発や保守をどこまでできるか試したら得るものが多かった話
drumnistnakano
0
290
Seamless Flutter Native Integration: FFI & Pigeon - Dreamwalker (JaichangPark / 박제창) @FlutterKaigi2024
itsmedreamwalker
0
120
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
850
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
490
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
HTTP compression in PHP and Symfony apps
dunglas
2
1.5k
CSC305 Lecture 25
javiergs
PRO
0
130
14 Years of iOS: Lessons and Key Points
seyfoyun
1
720
Djangoの開発環境で工夫したこと - pre-commit / DevContainer
hiroki_yod
1
690
Featured
See All Featured
Code Review Best Practice
trishagee
65
17k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
GitHub's CSS Performance
jonrohan
1030
460k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
The Language of Interfaces
destraynor
154
24k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
790
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
66
Faster Mobile Websites
deanohume
305
30k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
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