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
520
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
134
6.5k
Elixir and Ecto
vanstee
5
780
Bootstrap
vanstee
8
690
Consensus: An Introduction to Raft
vanstee
22
2.7k
Convergent Replicated Data Types
vanstee
4
640
Pour Over Brewing Method
vanstee
1
270
Celluloid & DCell
vanstee
4
440
Map Reduce & Ruby
vanstee
10
660
Other Decks in Programming
See All in Programming
Prompt FlowによるLLMアプリケーション開発
yuto2000
1
1k
大規模マルチテナントを解決するYugabyteDBという選択肢
nnaka2992
1
250
Introduction to GitOps
hwchiu
0
110
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
310
開発部に不満を持っていたCSがエンジニアにジョブチェンしてわかった「勝手に諦めない」ことの大切さ
sakuraikotone
28
16k
CSC307 Lecture 07
javiergs
PRO
0
220
英語
s_shimotori
1
220
入社1ヶ月でここまでやった!Findy Toolsインフラ支援の最適化
rvirus0817
6
1.4k
Rubyのパフォーマンスプロファイリングの改善 / Enhancing performance profiling for Ruby
osyoyu
1
410
20240706_CDKConf
takuyay0ne
0
1.2k
社内 LT 会を発足し、アウトプット文化を醸成させるために考えたこと・やったこと / Starting internal LT meetings and fostering an output culture
mackey0225
3
120
3 Effective Rules for Success with Signals in Angular
manfredsteyer
PRO
0
120
Featured
See All Featured
RailsConf 2023
tenderlove
16
720
5 minutes of I Can Smell Your CMS
philhawksworth
200
19k
Pencils Down: Stop Designing & Start Developing
hursman
118
11k
Optimizing for Happiness
mojombo
373
69k
Thoughts on Productivity
jonyablonski
64
4.1k
Typedesign – Prime Four
hannesfritz
37
2.2k
How to train your dragon (web standard)
notwaldorf
79
5.5k
GraphQLとの向き合い方2022年版
quramy
36
13k
The Cult of Friendly URLs
andyhume
75
5.9k
It's Worth the Effort
3n
181
27k
Web development in the modern age
philhawksworth
203
10k
A Tale of Four Properties
chriscoyier
155
22k
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