When we discuss APIs, most people immediately think of OAuth, GET and POST, and JSON. Few people think of the underlying concepts of nouns and verbs, idempotence, and uniform interfaces. Even less consider how we can combine these concepts into hypermedia to build APIs that are useful, logical, and future-friendly. Join us as we combine the basics, explore the larger concepts, and look at the standards that are leading the way.
11. Uniform Interfaces
Four principles:
1.Identification of Resources
2.Manipulation of Resources through these Representations
3.Self-descriptive Messages
4.Hypermedia as the engine of application state (HATEOAS)
16. Uniform Interfaces
Four principles:
1.Identification of Resources
2.Manipulation of Resources through these Representations
3.Self-descriptive Messages
4.Hypermedia as the engine of application state (HATEOAS)
17. Manipulation through those
Interfaces
Within Twilio:
/2010-04-01/Accounts/{AccountSid}/Calls/{CAxxx}
/2010-04-01/Accounts/{AccountSid}/Conferences/{CFxxx}
/2010-04-01/Accounts/{AccountSid}/Notifications/{NOxxx}
/2010-04-01/Accounts/{AccountSid}/Recordings/{RExxx}
/2010-04-01/Accounts/{AccountSid}/Queues/{QUxxx}
/2010-04-01/Accounts/{AccountSid}/SMS/{SMxxx}
/2010-04-01/Accounts/{AccountSid}/Transcripts/{TRxxx}
GET
POST
PUT
DELETE
{none}
{only for Calls & SMS}
n/a
{only for Recordings}
OPTIONS, HEAD, PATCH, TRACE, CONNECT
19. Uniform Interfaces
Four principles:
1.Identification of Resources
2.Manipulation of Resources through these Representations
3.Self-descriptive Messages
4.Hypermedia as the engine of application state (HATEOAS)
20. Self Descriptive
Each message should tell you:
•How to process itself
•If that resource is cacheable
•How to request the next resource
22. Uniform Interfaces
Four principles:
1.Identification of Resources
2.Manipulation of Resources through these Representations
3.Self-descriptive Messages
4.Hypermedia as the engine of application state (HATEOAS)
23. HATEOAS
“Clients make state transitions only through actions that are
dynamically identified within hypermedia by the server (e.g., by
hyperlinks“Clients make state transitions only through actions that
are dynamically identified within hypermedia by the server (e.g.,
by hyperlinks within hypertext). Except for simple fixed entry
points to the application, a client does not assume that any
particular action is available for any particular resources beyond
those described in representations previously received from the
server.”
Source: http://en.wikipedia.org/wiki/Representational_state_transfer#Guiding_principles_of_the_interface (Accessed 2013-11-01)