Data To Go
Mobile API Design
Chuck Greb
Mobile Platform Architect
AWeber Communications
@ecgreb
Data To Go
Good Mobile API Design
Chuck Greb
Mobile Platform Architect
AWeber Communications
@ecgreb
A Brief Survey
What is an API?
An application programming interface (API)
is a specification of how software
components should interact w...
Remote Service API
● Remote (web-based) services
● Desktop, laptop, or mobile client
● Communication protocol and data mod...
Web API Request
Mobile API Request
Mobile API requests are
generally slower and more
prone to timeouts and other
failures!
3 Principles of Good Mobile APIs
1. Reduce round trips to the server
2. Control verbosity
3. Restrict access
These 3 rules...
Principle #1
Reduce round trips to the server
● Resources are limited (battery,
bandwidth, memory, CPU)
● Eliminate networ...
Batch Request (3 in 1)
POST https://www.example.com/api/v1/login
Input
{"username":"chuck@example.com", "password":"Kronos...
Principle #2
Control Verbosity
● Slow connection speed
● Limited data plans $$$
● Purge irrelevant and empty data
● Specif...
Object Expansion
GET https://www.example.com/api/v1/user/123/recent_messages
{"recent_messages": [
{
"message_id":"101", "...
Principle #3
Restrict Access
● Identify the source of all requests
● Prevent unauthorized access
● Protect sensitive data
...
Authentication & Authorization
POST https://www.example.com/api/v1/login
Input
{"username":"chuck@example.com", "password"...
Thank You
Questions?
Chuck Greb
Mobile Platform Architect
AWeber Communications
@ecgreb
Upcoming SlideShare
Loading in …5
×

Data To Go: Mobile API Design (Lightning Talk)

502 views
362 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
502
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Data To Go: Mobile API Design (Lightning Talk)

  1. 1. Data To Go Mobile API Design Chuck Greb Mobile Platform Architect AWeber Communications @ecgreb
  2. 2. Data To Go Good Mobile API Design Chuck Greb Mobile Platform Architect AWeber Communications @ecgreb
  3. 3. A Brief Survey
  4. 4. What is an API? An application programming interface (API) is a specification of how software components should interact with each other. In most cases an API is a library that includes specification for routines, data structures, object classes, and variables. http://en.wikipedia.org/wiki/Application_programming_interface
  5. 5. Remote Service API ● Remote (web-based) services ● Desktop, laptop, or mobile client ● Communication protocol and data model (HTTP + REST + JSON)
  6. 6. Web API Request
  7. 7. Mobile API Request Mobile API requests are generally slower and more prone to timeouts and other failures!
  8. 8. 3 Principles of Good Mobile APIs 1. Reduce round trips to the server 2. Control verbosity 3. Restrict access These 3 rules don't always get along!
  9. 9. Principle #1 Reduce round trips to the server ● Resources are limited (battery, bandwidth, memory, CPU) ● Eliminate network overhead ● Brevity trumps discoverability ● Users are impatient
  10. 10. Batch Request (3 in 1) POST https://www.example.com/api/v1/login Input {"username":"chuck@example.com", "password":"Kronos"} Output { "user_id": 123 "access_token":"Y2h1Y2tAZXhhbXBsZS5jb20=", "name":"Chuck Greb", "email":"chuck@example.com", "avatar":"http://www.example.com/images/dh3d67kfb.jpg", "recent_messages": [ {"message_id":"101", "subject":"Hey!", "sender":{...}}, {"message_id":"102", "subject":"What's up?", "sender":{...}}, ... ] }
  11. 11. Principle #2 Control Verbosity ● Slow connection speed ● Limited data plans $$$ ● Purge irrelevant and empty data ● Specify verbosity level per request ● Object expansion
  12. 12. Object Expansion GET https://www.example.com/api/v1/user/123/recent_messages {"recent_messages": [ { "message_id":"101", "subject":"Hey bro!", "sender":{ "name":"Jeff Greb", "avatar":"http://www.example.com/images/dh3d67kfb.jpg"} }, ... ]} GET https://www.example.com/api/v1/message/101 { "message_id":"101", "subject":"Hey bro!", "sender":{ "name":"Jeff Greb", "avatar":"http://www.example.com/images/dh3d67kfb.jpg", "interests":["English", "Japanese", "Music", "Comedy", ...]}, "timestamp":"2013-6-12T13:38:22", "body":"Long time no see. What's new? I was thinking last..." }
  13. 13. Principle #3 Restrict Access ● Identify the source of all requests ● Prevent unauthorized access ● Protect sensitive data ● Mobile-friendly security model
  14. 14. Authentication & Authorization POST https://www.example.com/api/v1/login Input {"username":"chuck@example.com", "password":"Kronos"} Output { "user_id": 123, "auth_token":"Y2h1Y2tAZXhhbXBsZS5jb20=" ... } Header "Access-Token":"Y2h1Y2tAZXhhbXBsZS5jb20="
  15. 15. Thank You Questions? Chuck Greb Mobile Platform Architect AWeber Communications @ecgreb

×