Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
HTTP API Design for iOS Applications
Search
Patrick Van Stee
August 16, 2013
Programming
740
11
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
HTTP API Design for iOS Applications
Patrick Van Stee
August 16, 2013
Transcript
23 slides
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
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
143
7.9k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
870
Consensus: An Introduction to Raft
vanstee
21
3.4k
Convergent Replicated Data Types
vanstee
4
910
Pour Over Brewing Method
vanstee
1
450
Celluloid & DCell
vanstee
4
630
Map Reduce & Ruby
vanstee
10
950
Other Decks in Programming
See All in Programming
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
630
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
2.2k
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
270
Будущее локальных LLM – Алексей Голобурдин, PythoNN
sobolevn
0
120
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
320
手の動かし方がわからなかった私が個人開発者になるまで
usagi0920_pochi
0
100
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
0
250
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
190
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
150
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
340
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
170
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
380
Optimising Largest Contentful Paint
csswizardry
37
4k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
New Earth Scene 8
popppiees
5
2.8k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Mind Mapping
helmedeiros
1
440
Discover your Explorer Soul
emna__ayadi
2
1.3k
Between Models and Reality
mayunak
4
580
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.8k