*I just start exploring about RESTful services, and i find rest uses resource based URI so i just wanted to know what is the difference between them and is there resource based URI has any advantage over action based URI *
Asked
Active
Viewed 4,454 times
2
-
1Possible duplicate of [Understanding REST: Verbs, error codes, and authentication](http://stackoverflow.com/questions/2001773/understanding-rest-verbs-error-codes-and-authentication) – Justinas Jakavonis Aug 17 '16 at 06:59
1 Answers
9
Action-based URLs:
- Focus on the action being performed
- Usually include a verb
- Often rely on external sources to identify the resource being acted on (e.g., session state)
Resource-based URLs:
- Focus on the resource being acted on
- Usually consist of nouns
- Rely on HTTP verbs to define the action being performed (e.g., GET, PUT, POST, and DELETE)
Examples:
Action-based URL Resource-based URL
-----------------------------------------------------------------
GET /register GET /accounts/application
POST /register POST /accounts
GET /catalog/search GET /queries/form
POST /catalog/search POST /queries
GET /cart GET /order/123
POST /cart/add-item POST /order/123/items
POST /cart/empty DELETE /order/123
GET /check-out GET /order/123/invoice
POST /check-out POST /order/123/payments
GET /thank-you GET /order/123/receipt
POST /sign-in POST /sessions
POST /admin/delete-user?id=123 DELETE /user/123
GET /catalog/edit?id=123 GET /items/123/form
POST /catalog/edit?id=123 PUT /items/123

Community
- 1
- 1

Brandon Gano
- 6,430
- 1
- 25
- 25