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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Patrick Van Stee
August 16, 2013
Programming
11
680
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
141
7.3k
Elixir and Ecto
vanstee
5
980
Bootstrap
vanstee
8
820
Consensus: An Introduction to Raft
vanstee
21
3.1k
Convergent Replicated Data Types
vanstee
4
840
Pour Over Brewing Method
vanstee
1
390
Celluloid & DCell
vanstee
4
590
Map Reduce & Ruby
vanstee
10
870
Other Decks in Programming
See All in Programming
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.4k
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
300
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
230
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
550
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.4k
Python’s True Superpower
hynek
0
200
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
110
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
240
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
520
Codex の「自走力」を高める
yorifuji
0
180
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
350
要求定義・仕様記述・設計・検証の手引き - 理論から学ぶ明確で統一された成果物定義
orgachem
PRO
21
10k
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
99
Unsuck your backbone
ammeep
672
58k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
310
What's in a price? How to price your products and services
michaelherold
247
13k
Claude Code のすすめ
schroneko
67
220k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
400
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
The World Runs on Bad Software
bkeepers
PRO
72
12k
WCS-LA-2024
lcolladotor
0
470
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
200
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
660
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