Designing RESTful URLs for Web Pages

In most REST tutorials, resources are allocated as follows:

GET  /car/      -> list of cars
GET  /car/<id>/ -> info about specific car
POST /car/      -> create a new car

but when creating web applications for use in browsers, there is a missing link, which is rarely discussed, before you can use POST for / car /, you need to GET a form to create a new resource (car). What should be the URL for this form?

I usually used:

 GET  /car/new/ -> form for creating a new car
 POST /car/new/ -> redirect to /car/<id>/ if item is created else show form with invalid fields highlighted

but according to http://www.slideshare.net/Wombert/phpjp-urls-rest , this is not a very good REST URL. I see why this is not a good REST, because the “new” is really used as a verb, not a resource, but where should the form be, because it is GET /car/already used to list cars, so you can’t use the GET /car/form for new cars.

In short, my question is: "What is a RESTful URL for" creating a resource form "?"

, -, , , - , . AFAICS, (.. , , POST ). ?

+5
2

REST , URI, . , , . URI, .

, , , , , . RESTful , .

API REST (-) , / . , URI (, , ).

: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

, , REST. , - , .

+2

, "" , /<name>/new - API. "" , - , , .

+2

All Articles