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
CSC307 Lecture 11
javiergs
PRO
0
240
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
2
81k
HMSコンペ 11th Solution (team : kansai-kaggler)
t88
1
680
【Go言語】golangci-lintの使い方
tomo1227
0
270
Exploring the Gradually Lost Technical Skills in the Cloud Native Era
hwchiu
2
3.9k
Advanced App Shrinking Techniques
cbeyls
2
150
初心者がおさえておきたいAWS CDKのベストプラクティス 2024
konokenj
15
7.3k
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
はしめてのプログラミングとロボット制御
watawatavoltage
0
290
Product Management LT会_クアンド新家
shinshin
0
210
【Go言語】ジェネリクス
tomo1227
0
170
feature環境をGitHub ActionsとCloudFormationでいい感じに管理する
nealle
2
310
Featured
See All Featured
Statistics for Hackers
jakevdp
792
220k
We Have a Design System, Now What?
morganepeng
46
7k
Bash Introduction
62gerente
607
210k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
13
430
The Cost Of JavaScript in 2023
addyosmani
31
4.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
245
1.2M
The Cult of Friendly URLs
andyhume
75
5.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
15
4.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
12
3.8k
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