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
650
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
7.2k
Elixir and Ecto
vanstee
5
960
Bootstrap
vanstee
8
800
Consensus: An Introduction to Raft
vanstee
21
3k
Convergent Replicated Data Types
vanstee
4
790
Pour Over Brewing Method
vanstee
1
370
Celluloid & DCell
vanstee
4
570
Map Reduce & Ruby
vanstee
10
830
Other Decks in Programming
See All in Programming
CSC509 Lecture 11
javiergs
PRO
0
310
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.1k
詳細の決定を遅らせつつ実装を早くする
shimabox
1
1k
CSC509 Lecture 13
javiergs
PRO
0
250
JEP 496 と JEP 497 から学ぶ耐量子計算機暗号入門 / Learning Post-Quantum Crypto Basics from JEP 496 & 497
mackey0225
2
280
Promise.tryで実現する新しいエラーハンドリング New error handling with Promise try
bicstone
2
450
SUZURIの規約違反チェックにおけるクリエイタフィードバックの試⾏錯誤/Trial and Error in Creator Feedback for SUZURI's Terms of Service Violation Checks
ae14watanabe
1
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
500
CloudflareのSandbox SDKを試してみた
syumai
0
150
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
9
4.6k
開発生産性が組織文化になるまでの軌跡
tonegawa07
0
160
Phronetic Team with AI - Agile Japan 2025 closing
hiranabe
2
580
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
9.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Documentation Writing (for coders)
carmenintech
76
5.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
GitHub's CSS Performance
jonrohan
1032
470k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Building Adaptive Systems
keathley
44
2.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
11
930
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
1.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
24
1.6k
How STYLIGHT went responsive
nonsquared
100
5.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
658
61k
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