REST Url Design

Generic question

Which solution is the better one :

  1. /%user%/module_name/ressources/
  2. /module_name/%user%/ressources/

The first case will allow use to store the users in a database on the server. It allow us to have something really near from an hosting managment, but it remove to the user some possibility of configuration.

MySQL module

/mysql/
    GET     : list the mysql users
    PUT     : add a user (name, password)

/mysql/%user%/
    GET     : list the user database
    PUT     : add a database
    DELETE  : delete the user
    POST    : edit the user (password)

/mysql/%user%/%database%/
    GET     : list the database rights
    PUT     : add a database privilege
    DELETE  : delete the database

/mysql/%user%/%database%/alter-table/
/mysql/%user%/%database%/create-table/
/mysql/%user%/%database%/select/
    GET     : return the privilege status
    DELETE  : remove the privilege
    POST    : edit the privilege

Subversion module

/subversion/
    GET     : list the subversion repositories
    PUT     : add a repository
/subversion/%repository/
    DELETE  : remove the repository