In a RESTful application, can we distinguish between an “action” and an HTTP verb ( GET , POST , PUT , DELETE )?
For example, as I understand it, a GET request to the /products resource should return a list of all products. A POST request /products should create a new product. How does the user request the original form that is used to create the product? My initial answer would be a GET request for the same URI, but as mentioned above, this should return a list of all products, not an empty form for creating the product.
Most of the frameworks I investigated have solved this problem by creating an “action” part of the URI. For example, a POST request to /products/create will create a new product, while a GET request to /products/create will give an empty form for creating a product. For a list of all products, there would be a GET request for /products or /products/get , /products/read , etc. Depending on the structure under consideration. This approach removes the ambiguity above, but it contradicts what I read about traditional REST design.
source share