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
740
Bootstrap
vanstee
8
680
Consensus: An Introduction to Raft
vanstee
22
2.6k
Convergent Replicated Data Types
vanstee
4
610
Pour Over Brewing Method
vanstee
1
250
Celluloid & DCell
vanstee
4
410
Map Reduce & Ruby
vanstee
10
630
Other Decks in Programming
See All in Programming
PHPコードの実行モデルを理解する / Understanding-the-PHP-Execution-Model
shin1x1
0
880
Adding Security to Microcontroller Ruby
sylph01
0
140
Good first issues of TypeProf
mame
1
310
The Cutting Edge Of Versioning (LambdaConf 2024)
chriskrycho
0
250
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
160
AmperとFleetを使ったAndroidアプリ
yoppie
0
300
Deep Dive into React Stream/Serialize
mugi_uno
4
850
Open AI APIを使う前に知っておきたいアカウントTier の話
akki_megane
0
120
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
130
2024 コーディング研修
ckazu
2
630
スタックトレース始めてみた
kuro_kurorrr
4
1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
0
110
Featured
See All Featured
Web Components: a chance to create the future
zenorocha
306
41k
Writing Fast Ruby
sferik
622
60k
What's in a price? How to price your products and services
michaelherold
238
11k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
The Invisible Side of Design
smashingmag
294
49k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
34
6.1k
Unsuck your backbone
ammeep
664
57k
The Brand Is Dead. Long Live the Brand.
mthomps
49
30k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
Building Adaptive Systems
keathley
32
1.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Documentation Writing (for coders)
carmenintech
60
4k
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