Skip to content
Brojowski edited this page Jan 16, 2018 · 10 revisions

*Create a new user

POST /users
{
  "email": String,
  "password": String,
  "client": String
}

HTTP/1.1 201 Created
{
  "key": String,
  "token": String,
  "role": String,
  "refresh": String,
  "expires": String
}

*Quickly create a fully applied user (for registering at the door)

POST /users/quick
Auth -> admin, staff
{
  "name": String,   // full name
  "email": String,  // email address
  "phone": String   // phone number
}

HTTP/1.1 201 Created
{
  "_id": String,
  "email": String,
  "role": String,
  "created": Date,
  "application": {
    "name": String,
    "school": String,
    "phone": String,
    "shirt": String,
    "demographic": Boolean,
    "first": Boolean,
    "dietary": String,
    "year": String,
    "age": Number,
    "gender": String,
    "major": String,
    "conduct": Boolean,
    "travel": Boolean,
    "waiver": Boolean,
    "status": String,
    "going": Boolean,
    "checked": Boolean,
    "created": Date,
    "door": Boolean
  }
}

Get a key and token

POST /users/token
{
  "email": String,
  "password": String
}

HTTP/1.1 201 Created
{
  "key": String,
  "token": String,
  "role": String
}

Remove a token

DELETE /users/token
Auth

HTTP/1.1 200 OK

Get a list of all users

GET /users
Auth -> admin, staff

HTTP/1.1 200 OK
{
  "users": [{
    "_id": String,
    "email": String,
    "role": String,
    "created": Date
  }]
}

Get a user by ID

GET /users/:id
Auth -> admin, staff

HTTP/1.1 200 OK
{
  "_id": String,
  "email": String,
  "role": String,
  "created": Date
}

*Partially update the logged in user

PATCH /users
Auth
{
  "email": String,
  "password": String
}

HTTP/1.1 200 OK
{
  "_id": String,
  "email": String
}

*Partially update a user by ID

PATCH /users/:id
Auth -> admin
{
  "role": 'attendee'|'staff'|'admin'
}

HTTP/1.1 200 OK
{
  "_id": String,
  "email": String,
  "role": String,
  "created": String
}

*Delete a user

DELETE /users/:id
Auth -> admin

HTTP/1.1 200 OK
{
  "_id": String
}

Reset a password

This will send an email with a randomly generated new password to the user

POST /users/reset
{
  "email": String
}

HTTP/1.1 200 OK
{}

Clone this wiki locally