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
500
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
133
6.3k
Elixir and Ecto
vanstee
5
750
Bootstrap
vanstee
8
680
Consensus: An Introduction to Raft
vanstee
22
2.7k
Convergent Replicated Data Types
vanstee
4
620
Pour Over Brewing Method
vanstee
1
250
Celluloid & DCell
vanstee
4
420
Map Reduce & Ruby
vanstee
10
630
Other Decks in Programming
See All in Programming
From LALR to IELR: A Lrama's Next Step
junk0612
2
1.2k
新年度から始めるJava言語のファーストステップ2024
tatsuya1bm
0
150
プログラミング&実行できるWEBアプリを手作り
ohmori_yusuke
3
200
Androidで不安定なPlatform Viewsとの闘い
temoki
0
120
RAGのretrievalの評価を “ranx”で行う / Evaluate retrival of RAG using "ranx"
kun432
1
190
アクセシビリティの観点からみたFluent UI Blazorのすすめ
tomokusaba
1
180
gRPCでの効率的なAPI開発とテストの進め方
uo
2
170
ビジネスの構造をアーキテクチャに落とし込みソフトウェアに可変性を注入する
monotaro
PRO
10
2k
GoでParserを書く
karupanerura
3
550
BQで天気基盤をつくって、役立つ情報を可視化してみた!
wakamatsu_takumu
4
640
Enjoy Creative Coding with Ruby (RubyKaigi2024)
chobishiba
0
4.7k
製造業ドメインにOneTeamでディープ・ダイブする組織設計・組織運営
i_senaz
1
190
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
660
120k
Designing the Hi-DPI Web
ddemaree
276
33k
WebSockets: Embracing the real-time Web
robhawkes
59
7.1k
Rails Girls Zürich Keynote
gr2m
91
13k
Clear Off the Table
cherdarchuk
86
310k
Building Applications with DynamoDB
mza
88
5.7k
How GitHub (no longer) Works
holman
305
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
9
3.6k
Building Your Own Lightsaber
phodgson
100
5.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
16
1.6k
Learning to Love Humans: Emotional Interface Design
aarron
268
39k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
7k
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