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. Remote Service API
● Remote (web-based) services
● Desktop, laptop, or mobile client
● Communication protocol and data model
(HTTP + REST + JSON)
11. Principle #2
Control Verbosity
● Slow connection speed
● Limited data plans $$$
● Purge irrelevant and empty data
● Specify verbosity level per request
● Object expansion
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. Principle #3
Restrict Access
● Identify the source of all requests
● Prevent unauthorized access
● Protect sensitive data
● Mobile-friendly security model