Hi Nick,
>> Hypermedia does _not_ mean that application state is driven by the server.
>> Rather, it means that the information to manipulate the application state
>> is in the responses sent by the server, rather than hard-coded in the client.
>
> Not sure I agree about this. Yes, the client decides the "transition" to follow, but the state, which I guess is embedded in the links if the API is hypermedia is driven, would of course be managed by the server.
Depends on what you mean with "managed".
This term has different interpretations.
In one interpretation, "manage" could mean
that the server has to “keep track” of the application state.
For this interpretation, I disagree:
a REST server does not store application state.
In another interpretation "manage" could mean
that the server “decides” which state transitions are afforded.
For that interpretation, I agree.
> If the API is hypermedia driven the server would know what page you're on
The server does not (need to) know what page you are on;
it only knows what page you requested.
E.g., I request 37, which leads the server to send me
a hypermedia document that includes the link to page 38.
But as soon as the server has sent me this page,
it forgets what page the client is on.
It does not need to remember, because
the possible transitions are inside of the hypermedia document.
Therefore, the server does _not_ keep application state,
it only generates possible application state transitions.
> If the API is not hypermedia driven the client would have to keep track of what page they're on and generate the appropriate links for navigating between the pages.
Not necessarily. Another possibility is that the server
remembers on what page the client is,
and that the client sends a request "next page".
I.e., the server knows the client is on page 37,
the client sends a "next page" message,
so the server returns page 38.
You could even do this fully hypermedia-driven:
<a href="?next-page">next page</a>
This would be hypermedia but not REST,
exemplifying my statement that those are orthogonal.
> clients bind to specific identifiers instead of to a dialogue.
>
> What do you mean by 'dialogue'? Is that just another name for a link relation?
The dialogue consists of the messages exchanged by clients and servers.
A hypermedia document includes links (and link relations),
but there can be more inside of the response (data, metadata, controls).
> From my understanding, in a RESTful API, the server manages the state
That's incorrect, depending on the definition of "manages".
> It determines the possible transitions from a state. The client instructs the server on what transition to make and the server makes the state change.
Yes.
> The state is then transferred to the client to hold onto.
More precisely: the possible state transitions are transferred.
> if you choose to not use hypermedia the client will have to determine the application state after each transition.
This is not correct, as per my example above
in which the server keeps application state.
In non-REST scenarios, the client will typically be responsible
for generating its next message all by itself,
whereas hypermedia responses guide clients in generating messages.
This is the crucial difference.
Best,
Ruben
PS This discussion of application state versus resource state
might clear things up:
http://ruben.verborgh.org/blog/2012/08/24/rest-wheres-my-state/