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
Designing mobile friendly APIs
Search
Milan Cermak
February 13, 2014
Technology
0
97
Designing mobile friendly APIs
Slides from the talk I gave at 1st HTTP API group meetup in Berlin.
Milan Cermak
February 13, 2014
Tweet
Share
More Decks by Milan Cermak
See All by Milan Cermak
Building a CI/CD pipeline on AWS
milancermak
0
4.8k
HTTP API & Python
milancermak
3
220
Programování pro iOS z pohledu pythonistu
milancermak
0
220
Prečo povedať nie SQL
milancermak
1
110
Other Decks in Technology
See All in Technology
止まらないLinuxシステムを構築する_高信頼性クラスタ入門
koedoyoshida
2
430
Amplify 🩷 Bedrock 〜生成AI入門〜
minorun365
PRO
8
720
今年のRubyKaigiはProfiler Year🤘
osyoyu
0
360
実例で紹介するRAG導入時の知見と精度向上の勘所
yamahiro
5
1.6k
コードファーストの考え方。 Amplify Gen2から学ぶAWS次世代のWeb開発体験
yoshiitaka
2
370
How to do well in consulting–Balkan Ruby 2024
irinanazarova
0
140
Next.js に疲れた私は Vue3 に癒やされた
akagire
0
140
リテール金融(キャッシュレス・ネット銀行・ネット証券)の競争環境と経済圏
8maki
0
1.6k
Microsoft for Startups Founders Hub_20240429 update
daikikanemitsu
1
2.4k
Handling focus in 2024
tahia910
0
230
推しは推せるときに推せ! プロダクトにフィードバックしていこう
nakasho
0
460
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
270
Featured
See All Featured
The Cult of Friendly URLs
andyhume
74
5.7k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
The Invisible Customer
myddelton
114
12k
How GitHub (no longer) Works
holman
305
140k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
Building Effective Engineering Teams - LeadDev
addyosmani
31
1.9k
Git: the NoSQL Database
bkeepers
PRO
423
63k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
245
20k
Building a Scalable Design System with Sketch
lauravandoore
457
32k
Building an army of robots
kneath
300
41k
Fireside Chat
paigeccino
22
2.6k
Transcript
Mobile friendly APIs Milan Cermak HTTP API Meetup Group Berlin
Feb 13, 2014
General rules
be religious about documentation
when in doubt RFC 2616
Designing for mobile
Optimize for size and speed
• Bytes matter • Power consumption: • 3G > wifi
> 2G • On cellular, only 2 concurrent networking requests
Content-Encoding: gzip
ETag If-Match If-None-Match
Make the API flexible
Make the API flexible • fields parameter
GET /people/1! {“id”: 1,! “name”: “Milan Cermak”,! “age”: 27,! “hobbies”:
[“programming”, “ice cream”],! ...! }
GET /people/1?fields=name,age! {“name”: “Milan Cermak”,! “age”: 27}
Minimal vs. full approach ! • Send only the minimal
possible representation, let the users specify what they want via fields! • Send the full available representation of the resource
Make the API flexible • zoom parameter
GET /hobbies/programming! {“people”: [“1”, “2”, “3”, “5”, “8”, “11”],! “popularity”:
0.75,! ...! }
GET /hobbies/programming?zoom=people! {“people”: [! {“id”: 1,! “name”: “Milan Cermak”,! “age”:
27! ...! },! ...]! }
Batched requests
Batched requests • i.e. Facebook Graph API • A solution
until widespread adoption of HTTP2 • Not really RESTful, but really useful
POST /api/batch! {[! {“method”: “GET”! “relative_url”: “people/1”! },! {“method”: “GET”,!
“relative_url”: “hobbies/dogs”! }! ]}
Batched requests • Server-side implementation can be tricky: • Error
handling • HTTP headers • Parallel execution vs. POST/PUT/DELETE
Thank you