I'm trying to RESTify an existing Web application, and have a
stylistic question.
Imagine that a Web application fronts for a database, where all of the
records are available as resources.
For example, you could search the database at
http://www.example.org/search
and the results would point at records, like
http://www.example.org/records/theThing
One can add to the database by doing a get (for the form) and then a
POST to
http://www.example.org/add
Now, how should editing and deletion be done? One approach is to
expose an edit resource, similar to the add one;
http://www.example.org/edit
To edit a specific resource, one could use a query string;
http://www.example.org/edit?resource=theThing
and use GET and POST to get the form and POST the edit.
Another approach would be to use the resource's native URI, like
http://www.example.org/records/theThing?mode=edit
in a similar manner. This seems to be the approach taken by most
WIKIs, interestingly.
Is either approach preferable/horrible, or are they pretty much the
same? The specific application is a gateway to an LDAP database. I
haven't read Roy's full dissertation (still!), so apologies if I've
asked a FAQ.
Deletion is another interesting case; if each LDAP entry really is a
resource, DELETE would be most appropriate, no? Unfortunately, methods
other than GET and POST aren't available from HTML...
Cheers,
P.S.; Do queries identify a new resource? Their defined as a mechanism
to pass data to the server. Common use (as outlined above) seems to
indicate that people don't consider them separate, but in the URI
world, they're not lumped into URI-References with fragments...