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
610
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.9k
Elixir and Ecto
vanstee
5
910
Bootstrap
vanstee
8
770
Consensus: An Introduction to Raft
vanstee
22
2.9k
Convergent Replicated Data Types
vanstee
4
730
Pour Over Brewing Method
vanstee
1
330
Celluloid & DCell
vanstee
4
530
Map Reduce & Ruby
vanstee
10
770
Other Decks in Programming
See All in Programming
Agentic Applications with Symfony
el_stoffel
2
280
Rollupのビルド時間高速化によるプレビュー表示速度改善とバンドラとASTを駆使したプロダクト開発の難しさ
plaidtech
PRO
1
170
On-the-fly Suggestions of Rewriting Method Deprecations
ohbarye
1
1.3k
Strategic Design (DDD)for the Frontend @DDD Meetup Stuttgart
manfredsteyer
PRO
0
130
Signal-Based Data FetchingWith the New httpResource
manfredsteyer
PRO
0
170
MCP世界への招待: AIエンジニアが創る次世代エージェント連携の世界
gunta
4
900
5年間継続して開発した自作OSSの記録
bebeji_nappa
0
190
Road to RubyKaigi: Making Tinny Chiptunes with Ruby
makicamel
4
100
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
150
データベースエンジニアの仕事を楽にする。PgAssistantの紹介
nnaka2992
9
4.5k
SwiftUI API Design Lessons
niw
1
280
DomainException と Result 型で作る型安全なエラーハンドリング
karszawa
0
900
Featured
See All Featured
A better future with KSS
kneath
239
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
It's Worth the Effort
3n
184
28k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.5k
Writing Fast Ruby
sferik
628
61k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
Practical Orchestrator
shlominoach
186
10k
The Invisible Side of Design
smashingmag
299
50k
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