You could then PATCH the BlogPost with the link to whatever BlogPostVersion you want to update to.
Curious to see what others would recommend.
Since REST is all about mapping to the underlying semantics of HTTP you'd then want to make /posts/X redirect to /posts/X/versions/U-U-I-D
Since there's nothing wrong with updating your resource under the hood (think of e.g. http://www.weather.com/weather/right-now/) posts/X would simply always redirect to the latest version.
If you don't always use the latest version by definition, then you'd probably do a PATCH with the new version id to /posts/X, or a PATCH with 'active: true' to /posts/X/version/O-L-D.
PATCH /posts/X
{ "version": "older-revision" }
or PATCH /posts/X/versions/older-revision
{ "active": true }
Access control is completely orthogonal to this; so for your sample case you would just return a 403 for any other calls (like e.g. POSTs to /posts/X/versions)Seriously REST isn't a mystery. I think the problem is few understand what it is. Here is my 30-second version:
1. Identification of resources and manipulation through representations. This means a network resource should have a URL that is the same no matter what you are doing to it - getting changing, removing, modifying or any custom manipulation. For the Web, use HTTP verbs and request body data to define the actions.
2. Self-descriptive error messages. Don't return 200 OK for everything. Use status codes and verbose response bodies to describe what happened.
3. Hypermedia as the engine of application state. Expose ALL functionality in HTML using hyperlinks and forms.
However I think what this whole discussing is missing is the properties that you derive by adhering to a REST design.
I think there should be some tests of a design to see if you are actually getting the benefits of REST.
For example in a REST design you can re-arrange the internal URL's in a server and the site is still usable to clients because they are following links from the root.
Why do we want this ability to rearrange URLs?
Example: think of posts here on HN. One thing a specific media format would include is a "reply" link, but on hellbanned posts that link would absent, so that state would be inaccessible to clients.
Or say you've used comments on your blog, so each post has a link to the list of comments about it. Now you switch to Disqus, and so you could change the URL to point to their comments pages instead, and a decent client would use it transparently (assuming good media types).
All of this is taken for granted and used a lot on the real RESTful space: the HTML Web.
One way is to use the newest version in Client and the Server has to convert old Data to new Data, then deliver to Client. But sometimes it not so easy, depend on complexity of your data.
Other way: convert all Data to new Version and change Data-Access in the old Api Version (but here is the Problem with: never change a running system, things that work before could go wrong). And if you have a huge site with many users, it is not possibly to interrupt the service.
To maintain many versions is for a short period ok, but for longer usage not practicable.
Did somebody have experience with that ?