Suppose you just discovered Twitter and are using it for the first time. In your web browser, you see a paragraph column with a bunch of links spreading across the page. You know that there is a way to do something with this, but you don’t know specifically what actions are available. How do you find out what it is?
Well, you look at the links and think about what their names mean. Some of them are immediately recognized by convention . As an experienced web user, you have a pretty good idea that to achieve this you need to click on the links "home", "search" and "exit".
But other links have names that you don’t recognize. What does retweeting do? What does the icon of this little star do?
Basically you can or not:
Through the experiment , that is, clicking on the links and viewing what is happening, then deriving the meaning for each link from the results.
Through some source of out-of-band information , such as online help, a tutorial found through a Google search, or a friend sitting next to you, explaining how the site works.
Same thing with the REST API. (Recall that REST is designed to model how the Web interacts with people.)
Although, in principle, computers (or API client developers) could derive the semantics of relationship relationships through experimentation, this is obviously not practical. It leaves
There is nothing controversial in the concept of REST, requiring client developers to rely on something other than the API itself to understand the meaning of link relationships. This is standard practice for people using websites, and people using websites are REST models.
What REST does is eliminate the need for out-of-band mechanism information API interactions. Returning to the Twitter example, you probably should have someday explained to someone exactly what is going on in the retweet link. But you didn’t need to know which specific URL you entered to retweet, or the tweet ID you wanted to act on, or even the fact that the tweets had unique identifiers. Web design meant that all this complexity was taken care of by you as soon as you figured out which link you would like to click.
And so it is with the REST API. It is true that in most cases, the computer or programmer just needs to say what the relation of each link means. But once they get this information, they can navigate throughout the API without having to know anything else about the details of how it all comes together.