We have a project that uses classic MVC controllers and WebAPI controllers. The classic controllers just serve up HTML. Any data gets passed around using WebAPI.
My co-worker pointed out that RESTful URLs identify resources and the GET/POST/PUT/DELETE are the verbs. I am curious if we should be following the same conventions for the pages themselves.
I am finding it really difficult to name the pages using RESTful conventions. For instance, the only thing that distinguishes an Index vs a Create vs an Edit page is whether or not the route includes an ID or query string. Before, I just had /Account, /Account/Create and /Account/Edit. With REST, everything goes under /Account and I have to distinguish based on IDs or query strings. I feel like I shouldn't be using RESTful conventions for naming pages.
Clarification
Any data being transferred in the application uses WebAPI. So, for an account, we'd have these actions available:
GET /accounts - Gets all the accounts
GET /accounts/123 - Gets the account with the ID 123
POST /accounts - Creates a new account
PUT /accounts/123 - Updates account with ID 123
DELETE /accounts/123 - Delete account with ID 123
Some times the PUT method assumes the ID is in the body.
The HTML is returned by normal MVC controllers. In this case, there is only ever GETs. The HTML is almost completely static (we store IDs in hidden fields). AJAX is used to load the data using the REST API.
I am wondering if the HTML pages should use REST-like URLs or if I should use URLs found in older MVC projects. This is what was proposed by a co-worker:
GET /accounts - Gets a screen with all of the accounts
GET /accounts/123 - Gets the HTML for viewing a single account
GET /accounts - Gets the HTML for creating a new account (already in use!)
GET /accounts/123 Gets the HTML for updating an account (already in use!)
Since GET is always the HTTP method, I need something more than just a URL to distinguish screens. With old MVC routes, the action was part of the URL:
GET /accounts/Index - Gets the screen with all of the accounts
GET /accounts/Index/123 - Gets the screen for a single account
GET /accounts/Create - Gets the screen for creating an account
GET /accounts/Edit - Gets the screen for editing an account
Some of the answers point out that HTML pages are just resources. In my mind, they are just views, but are not yet a true representation of another resource. Not until the data is brought back and bound to the HTML is it a true "representation". With that in mind, isn't a static HTML page just like any other static content, like an image? Should RESTful URL conventions apply to things like images?