do:
- Build your application as hypertext-driven (Hypermedia as the application state engine - HATEOAS).
- Spend most of your time and effort identifying resources and creating media types to represent them.
- Think of all the URIs as a resource identifier and assume that it will change in the future.
- Provide all options for further promotion through your application as links in your presentation.
- Think of your application as a website that will be “crawled” or “viewed” by customers.
- Try writing a client for your API and see where the connection occurs.
Not
- Publish URI patterns in the API documentation. If you must have templates for query parameters, for example, make sure they are part of your media type definition.
- Think of your application as a set of URIs with four verbs.
- Provide clients with mime types, such as "application / xml" or "application / json".
To use the analogy, your API should work more like GPS for your customers and less like a map. You will only provide customers with the name of a nearby street. But from now on, they can only do what your application says, what they can do at any time.
The goal of this style is to minimize the connection between your application and its clients. All communication should be done in determining your media type. This simplifies the evolution of the API and provides a good mechanism for version control. He also asks questions about issues such as pagination.
Most RESTful APIs do not match this pattern. For what it does, see the Sun Cloud API and backstory .
Rich apodaca
source share