Skip to content

API Calls

Mayukha Vadari edited this page Jul 5, 2020 · 1 revision

Authentication/Account

/api/user/

  • GET only
  • Permissions: logged in
  • Parameters: None
  • Returns information about logged-in user (currently username, is_student, is_teacher)

/api/token/

  • POST only
  • Permissions: None
  • Body: username, password
  • Used to log in, returns access + refresh tokens for the user if successful

/api/token/refresh/

  • GET only
  • Permissions: None
  • Body: refresh (refresh token)
  • Returns new access + refresh tokens for the user (refresh token is the same if ROTATION=False in settings.py)

/api/account/student/

  • POST only
  • Permissions: None
  • Body: ESPUser and StudentProfile details
  • If successful, returns access + refresh tokens (errors aren't being handled yet)

/api/profile/

/student/

  • GET: get student profile info
  • POST: update student profile info

Dashboard

/api/dashboard/student/

  • GET only
  • Permissions: logged in, is_student
  • Parameters: None
  • Returns json (sorted by "name") of the form
{"current": [{"name": "HSSP 1957", "url": "HSSP/1957", "registered", /*whether the student has begun registration for the program*/}],
 "previous": ["{"name": "HSSP 1957", "url": "HSSP/1957"}]
}

Current programs are ones with open or ongoing registration, and previous programs are ones that the student has registered for in the past.

/api/dashboard/teacher/

  • GET only
  • Permissions: logged in, is_student
  • Parameters: None
  • Returns sorted list of programs that have open teacher registration
  • Will be replaced by something analogous to api/studentdashboard

Program-Specific

All of these URLs are prepended with /api/[program]/[edition]/ (and eventually will also have the option of /api/[program]/[season]/[edition]/

/student/

  • GET only
  • Permissions: logged in, is_student, registered for the program
  • Parameters: None
  • Returns a JSON of all the data in the current user's StudentRegistration object

/emergency_info/

  • Permissions: logged in, is_student, registered for the program
  • GET: no params, returns the emergency info of the student
  • POST: update the emergency info of the student

/medliab/

  • Permissions: logged in, is_student, registered for the program
  • GET: no params, returns the medliab status of the student
  • POST: update the medliab status of the student

/waiver/

  • Permissions: logged in, is_student, registered for the program
  • GET: no params, returns the liability wiaver status of the student
  • POST: update the liability waiver status of the student

/availability/

  • Permissions: logged in, is_student, registered for the program
  • GET: no params, returns the availability of the student
  • POST: update the availability of the student