In a discussion of restful features the other day, a good question came up: where's the back button? POST and PUT are easy to understand, but how about rolling back or undoing changes? I have a simple solution which is going to look pretty familiar to Subversion users.
Let's beginning by modifying a feature:
PUT /features/1
{ ... }
The curly braces and ellipsis stand in for a JSON object, the details of which aren't important now. From a versioning feature resource, I'd want to get a response like:
200 OK
feature: http://example.org/features/1
revision: http://example.org/features/1/revisions/1
Representations of the feature and its most recent revision are identical. Want to rollback this change? First, let's get the previous revision:
GET /features/1/revisions/0
{ ... // revision 0 }
and then put it back:
PUT /features/1
{ ... // revision 0 }
With the response:
200 OK
feature: http://example.org/features/1
revision: http://example.org/features/1/revisions/2
That's the restful equivalent of:
$ svn merge -r 1:0 http://example.org/features
$ svn commit
OSM, by the way, has node history, but no URIs for node revisions.
Comments
Re: Stop Using Mapscript: Almost There
Author: Al
I am just getting into MapServer and have found your posts to be very enlightening. I have only gotten to the point that I can see how I would use MapScript to overlay a map with icons positioned via data in a MySQL DB. Is it possible to duplicate that sort of functionality with map files? Any pointers on where I could see examples of that? Thanks, AlRe: Stop Using Mapscript: Almost There
Author: Sean
Al, you can use the mapfile language to define an OGR wrapper for your MySQL table. Google for "mapserver ogr virtual mysql" and you'll find examples.