At some point, we all need to design and implement APIs for the Web. What makes Web APIs different than typical component APIs? How can you leverage the power of the Internet when creating your Web API? What characteristics to many "great" Web APIs share? Is there a consistent process you can use to make sure you design a Web API that best fits your needs both now and in the future?
In this session Mike Amundsen describes a clear methodology for designing Web APIs (based on the book "RESTful Web APIs" by Richardson and Amundsen) that allows you to map key aspects of your business into a usable, scalable, and flexible interface that will reach your goals while creating a compelling API for both server and client developers. Whether you are looking to implement a private, partner, or public API, these principles will help you focus on the right metrics and design goals to create a successful API.
42. 1. List the Semantic Descriptors
(the what?)
You know, the stuff!
43. 1. List the Semantic Descriptors
● A maze
● A maze cell
● A switch
● Switch position ("up" or "down")
● The title of a maze cell
● A doorway connecting to cells
● An exit from the maze
● A list of mazes
54. 3. Reconcile Names
● IANA
o edit
o start
o current
● microformats
o exit
o north, south, east, west
● RFC5988
o http://mamund.com/rels/switch
o http://mamund.com/rels/maze
59. 4. Choose a Media Type
● Use application/json, application/xml
● Collection type: Atom, OData, Collection+JSON
● Free-form: HTML, Siren, HAL, JSON-LD
● Invent your own semantic type
60. 4. Choose a Media Type
● Use application/json, application/xml
● Collection type: Atom, OData, Collection+JSON
● Free-form: HTML, Siren, HAL, JSON-LD
● Invent your own semantic type
61. 4. Choose a Media Type
● Use application/json, application/xml
● Collection type: Atom, OData, Collection+JSON
● Free-form: HTML, Siren, HAL, JSON-LD
● Invent your own semantic type
62. 4. Choose a Media Type
● Use application/json, application/xml
● Collection type: Atom, OData, Collection+JSON
● Free-form: HTML, Siren, HAL, JSON-LD
● Invent your own semantic type
63. 4. Choose a Media Type
● Use application/json, application/xml
● Collection type: Atom, OData, Collection+JSON
● Free-form: HTML, Siren, HAL, JSON-LD
● Invent your own semantic type
85. Seven Simple Steps
1. List the Semantic Descriptors
2. Draw a State Diagram
3. Reconcile Names
4. Write a Profile
5. Select a Media Type
6. Implementation
7. Publication
100. Some Final Advice
● Resources are implementation details
● Don't fall into the collection trap
● Don't start w/ the representation format
● URL design doesn't matter
● Standard names are probably better than
yours
● Don't keep all the hypermedia in one place
107. In Conclusion...
● Don't confuse implementation w/ design
● Design is the hard part (high value)
● Implementation is the easy part (high speed)
● Avoid common design mistakes
● Go out and make lots of APIs!