Skip to content
Chinni Chaitanya edited this page Jun 5, 2015 · 2 revisions

POST to /api/users/
Request body:

  • email: email ID of the user
  • name: name of user
  • nick: nickname of the user (optional)
  • profilePic: link to the profile picture
  • rollNumber: Roll Number
  • hostel: An object with two keys - name and value. Name can be as per convinience, values are to match with entries in user.model.js
  • roomNumber: String with numerical room Number
  • city: String with city name
  • summerLocation: Summer City name
  • cgpa: CG. keep it below 10
  • phoneNumber: exactly 10 digit string. No 0, +91, etc

Response: The created user object with a token

GET to /api/users/
Must be logged in
Response:
Array of all user objects

GET to /api/users/me
Must be logged in
Response:
Only the present User data

GET to /api/users/:id
:id means that you can put any string and that will be taken as a parameter
Request Parameters:
id: ID of the user being queried
Response: User object of that specific user

PUT to /api/users/:id/password
User must be logged in
Change password of user. This will work only if id matches the request user
Request Body:
oldPassword: The old Password
newPassword: The new Password
Response:
200 OK status if success.

PUT to /api/users/:id/updateProfile
User must be logged in Change any details of user, except email and password. Will only work if id matches the request User
Request Body:
Any filed you want to change, others can be empty.
Response:
200 OK status if success.

POST to /api/users/forgotPassword Request Body:
email: Email Id of user Response:
A mail will be sent with recovery link and a string token. Can paste it in a box to continue or click on link. Expires in one hour.

POST to /api/users/resetPassword/:token
Request Params: token : The token sent by email Request Body: newPassword : The new password changed according to the user.

Clone this wiki locally