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
630
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
140
7k
Elixir and Ecto
vanstee
5
930
Bootstrap
vanstee
8
780
Consensus: An Introduction to Raft
vanstee
22
2.9k
Convergent Replicated Data Types
vanstee
4
750
Pour Over Brewing Method
vanstee
1
340
Celluloid & DCell
vanstee
4
540
Map Reduce & Ruby
vanstee
10
790
Other Decks in Programming
See All in Programming
つよそうにふるまい、つよい成果を出すのなら、つよいのかもしれない
irof
1
290
Claude Codeの使い方
ttnyt8701
1
130
カクヨムAndroidアプリのリブート
numeroanddev
0
430
Rails産でないDBを Railsに引っ越すHACK - Omotesando.rb #110
lnit
1
170
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
540
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
120
從零到一:搭建你的第一個 Observability 平台
blueswen
1
960
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
1
820
レガシーシステムの機能調査・開発におけるAI利活用
takuya_ohtonari
0
610
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
41
27k
C++20 射影変換
faithandbrave
0
500
データベースコネクションプール(DBCP)の変遷と理解
fujikawa8
1
270
Featured
See All Featured
Facilitating Awesome Meetings
lara
54
6.4k
Building Applications with DynamoDB
mza
95
6.5k
The Invisible Side of Design
smashingmag
299
51k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
920
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Side Projects
sachag
455
42k
Embracing the Ebb and Flow
colly
86
4.7k
Thoughts on Productivity
jonyablonski
69
4.7k
Bash Introduction
62gerente
614
210k
The Pragmatic Product Professional
lauravandoore
35
6.7k
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