How To Send Html Form Restfully?
Solution 1:
In my mind, the only cleanly RESTful answers are 1 and 3.
As I see it, the description of the resource is a resource of its own. The question is whether you want to make this resource accessible through your application's API or if you want to make it part of the API itself.
For 1, it seems RESTful make the URIs something like this:
GET /facts -> all facts GET /facts/1 -> returns fact 1 (obviously the id might be a word or something else) GET /facts/create -> returns a form appropriate for creating a fact POST /facts -> adds a fact
Solution 2:
I think you're overcomplicating things a bit. A web browser is just not a perfect REST client, so you can't have a perfectly RESTful solution. In a perfect world, you would not need a form at all, because the web browser would know your media types and build the form itself.
Meanwhile, I suggest you just use what most REST frameworks would call an additional "view" on the resource to return a form:
E.g. /your/collectionresource?view=form
, or /your/collectionresource;form
Post a Comment for "How To Send Html Form Restfully?"