Skip to content

Sprint 1.2 UserController

Cyril Yared edited this page Nov 24, 2018 · 7 revisions

UserController

POST createUser

  • User story:
    • As an user, I would like to be able to create an account in order to use the application.
  • HTTP mapping: /api/user/create
  • Returns
    • Success: "{role} {userName} created." (200 Status Code)
    • Failure: "{role} {userName} could not be created, select a new username and make sure your email has not been used before."
Parameters Type Description
username String user's username
email String user's email adress
name String user's name
role String passenger, driver, or administrator
password String user's password

POST updateUser

  • User story:
    • As an user, I would like to update my profile so that I can change my credentials/role.
  • HTTP mapping: /api/user/update
  • Returns
    • Success: Updated User Object (200 Status Code)
    • Failure: null
Parameters Type Description
username String user's username
email String user's email adress
name String user's name
role String passenger, driver, or administrator
oldpass String user's password
newpass String user's new password

POST authenticateUser

  • User story:
    • As a user, I would like to have my own private account so my information/history of trips remain confidential.
  • HTTP mapping: /api/user/authenticate
  • Returns
    • Success: User ID (200 Status Code)
    • Failure: -1
Parameters Type Description
username String user's username
password String user's password

POST login

  • User story:
    • As a user, I would like to login and verify my role.
  • HTTP mapping: /api/user/login
  • Returns
    • Success: Role (200 Status Code)
    • Failure: ""
Parameters Type Description
username String user's username
password String user's password

POST authorize

  • User story:
    • As a user, I would like to have my own private account so my information/history of trips remain confidential.
  • HTTP mapping: /api/user/authorize
  • Returns
    • Success: User ID (200 Status Code)
    • Failure: -1
Parameters Type Description
username String user's username
password String user's password
role String user's role

GET getUser

  • User story:
    • As an administrator, I would like to find a user with their ID so I can manage things if needed.
  • HTTP mapping: /api/user/users/{id}
  • Returns
    • Success: User Object (200 Status Code)
    • Failure: null
Parameters Type Description
adminusername String Admin username
adminpassword String Admin password
id int ID's corresponding user
  • Note: The URL for an HTTP GET will look like this https://rideshare08.herokuapp.com/api/user/users/1?adminusername=admin&adminpass=password. This will retrieve user 1 with the admin username "admin" and the admin password "password."

POST findUser

  • User story:
    • As a administrator, I would like to find a user by certain attributes so that I can manage things if needed.
  • HTTP mapping: /api/user/find
  • Returns
    • Success: List of User objects (200 Status Code)
    • Failure: null
Parameters Type Description
adminusername String Admin username
adminpassword String Admin password
username String user's username
password String user's password
email String user's email address

POST getUnfilteredUserList

  • User story:
    • As an administrator, I would like to get the list of every user so I can manage things if needed.
  • HTTP mapping: /api/user/userlist
  • Returns
    • Success: List of User Objects (200 Status Code)
    • Failure: null
Parameters Type Description
username String admin username
password String admin password

POST getFilteredUserList

  • User story:
    • As an administrator, I would like to get the filtered list of top users so I can manage things if needed.
  • HTTP mapping: /api/user/fuserlist
  • Returns
    • Success: List of User Objects (200 Status Code)
    • Failure: null
Parameters Type Description
username String admin username
password String admin password