[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves
WordPress Trac
noreply at wordpress.org
Thu Mar 8 18:06:21 UTC 2018
#43316: REST API: Support autosaves
-------------------------------------+-----------------------
Reporter: kraftbj | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: rest-api
-------------------------------------+-----------------------
Comment (by schlessera):
My suggestion is to use a new route `/autosaves` extending the revisions
controller.
The concept of an "Autosave" is different to the concept of a "Revision",
even though right now, they are technically implemented in a similar
manner and store in the same table. That could potentially change at any
moment, though. Routes should be modeled after concepts, not how stuff is
stored in the DB.
The `/autosaves` endpoint would be used on the client to "trigger" an
autosave. The server then decides how (or if) to store that autosave. The
server then emits a response to the client, which could contain contextual
data that the client needs to provide needed visual feedback. As an
example, it could provide the latest valid autosave (=revision) ID. This
can be used on the client to adapt its state.
Letting the client decide whether to actually store the autosave or not is
not recommend imho, because:
- The client does not have the necessary knowledge to make this decision.
It would either require direct access to the DB or multiple network
roundtrips to decide.
- The client should be in control of the logic that defines user
interactions, and the server should be in control of the logic that
defines the business domain. A client is not to be trusted, so giving it
too much decisional power is a security liability.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list