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
580
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
137
6.7k
Elixir and Ecto
vanstee
5
870
Bootstrap
vanstee
8
740
Consensus: An Introduction to Raft
vanstee
22
2.9k
Convergent Replicated Data Types
vanstee
4
700
Pour Over Brewing Method
vanstee
1
320
Celluloid & DCell
vanstee
4
510
Map Reduce & Ruby
vanstee
10
740
Other Decks in Programming
See All in Programming
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.3k
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
420
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
為你自己學 Python
eddie
0
520
functionalなアプローチで動的要素を排除する
ryopeko
1
190
ドメインイベント増えすぎ問題
h0r15h0
2
560
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
560
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
1.2k
快速入門可觀測性
blueswen
0
500
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
280
Beyond ORM
77web
11
1.6k
Featured
See All Featured
Facilitating Awesome Meetings
lara
51
6.2k
Documentation Writing (for coders)
carmenintech
67
4.5k
Side Projects
sachag
452
42k
Building an army of robots
kneath
302
45k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
What's in a price? How to price your products and services
michaelherold
244
12k
Mobile First: as difficult as doing things right
swwweet
222
9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Statistics for Hackers
jakevdp
797
220k
Become a Pro
speakerdeck
PRO
26
5.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
350
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