Skip to content

RESTful API Documentation

Emma Eagles edited this page Apr 7, 2019 · 26 revisions

Root

Visiting this link will show the routes that can be accessed to get all students, all employers, etc.

  • Route: https://ecse321-group17.herokuapp.com/

Contents

GET Routes

Get Student

Returns a single student with the specified email.

  • Route: https://ecse321-group17.herokuapp.com/student/{email}
  • Example: https://ecse321-group17.herokuapp.com/student/student@mail.mcgill.ca

Get Employer

Returns a single employer with the specified email.

  • Route: https://ecse321-group17.herokuapp.com/employer/{email}
  • Example: https://ecse321-group17.herokuapp.com/employer/employer@company.ca

Get Co-op Administrator

Returns a single administrator with the specified email.

  • Route: https://ecse321-group17.herokuapp.com/admin/{email}
  • Example: https://ecse321-group17.herokuapp.com/admin/admin@mcgill.ca

Get Co-op Term

Returns a single co-op term with the specified ID.

  • Route: https://ecse321-group17.herokuapp.com/coop/{id}
  • Example: https://ecse321-group17.herokuapp.com/coop/123

Get Co-op Terms For Student

Returns all co-op terms for the specified student.

  • Route: https://ecse321-group17.herokuapp.com/student/coops/{email}
  • Example: https://ecse321-group17.herokuapp.com/student/coops/student@mcgill.ca

Get All Students

Returns all students in the database.

  • Route: https://ecse321-group17.herokuapp.com/students

Get All Employers

Returns all employers in the database.

  • Route: https://ecse321-group17.herokuapp.com/employers

Get All Co-op Terms

Returns all co-op terms in the database.

  • Route: https://ecse321-group17.herokuapp.com/coops

Get All Co-op Administrators

Returns all co-op administrators in the database.

  • Route: https://ecse321-group17.herokuapp.com/admins

Get Co-op Terms For Employer

Returns all co-op terms for the specified employer.

  • Route: https://ecse321-group17.herokuapp.com/employer/coops/{email}
  • Example: https://ecse321-group17.herokuapp.com/employer/coops/employer@company.ca

Get Co-op Terms By Company

Returns all co-op terms for the specified company.

  • Route: https://ecse321-group17.herokuapp.com/coops-by-company/{company}
  • Example: https://ecse321-group17.herokuapp.com/coops-by-company/Lightspeed

Get Employers By Company

Returns all co-op terms for the specified company.

  • Route: https://ecse321-group17.herokuapp.com/employers-by-company/{company}
  • Example: https://ecse321-group17.herokuapp.com/employers-by-company/Facebook

Get Co-op Progress For A Specific Co-op

Returns the status, start and end dates, and all report information for the specified co-op.

  • Route: https://ecse321-group17.herokuapp.com/progress/coop/{id}
  • Example: https://ecse321-group17.herokuapp.com/progress/coop/12345

Get All Reports For A Specific Student

Returns all reports across all co-ops done by the specified student.

  • Route: https://ecse321-group17.herokuapp.com/reports/student/{email}
  • Example: https://ecse321-group17.herokuapp.com/reports/student/student@mail.mcgill.ca

Get All Reports For A Specific Coop

Returns all reports submitted for the specified co-op.

  • Route: https://ecse321-group17.herokuapp.com/reports/coop/{id}
  • Example: https://ecse321-group17.herokuapp.com/reports/coop/123

Get Co-op Statistics

Returns relevant statistics for co-op terms that can be filtered by a specified range and co-op number, i.e. a co-op number of 2 would return the 2nd co-op terms of all students. StartTerm and EndTerm must be of the form Winter2019.

  • Route: https://ecse321-group17.herokuapp.com/statistics/coop/{startTerm}/{endTerm}/{coopNumber}
  • Example: https://ecse321-group17.herokuapp.com/statistics/coop/Summer2018/Summer2019/1

Get Report Statistics

Returns relevant report statistics for co-op terms that can be filtered by a specified range and co-op number, i.e. a co-op number of 2 would return the 2nd co-op terms of all students. StartTerm and EndTerm must be of the form Winter2019.

  • Route: https://ecse321-group17.herokuapp.com/statistics/report/{startTerm}/{endTerm}/{coopNumber}
  • Example: https://ecse321-group17.herokuapp.com/statistics/report/Winter2018/Winter2019/2

Get Co-op Progress

Returns statistics related to the progress of a specific co-op.

  • Route: https://ecse321-group17.herokuapp.com/progress/coop/{id}
  • Example: https://ecse321-group17.herokuapp.com/progress/coop/321

Get Problematic Students

Returns a list of students who have late reports or incomplete coops.

  • Route: https://ecse321-group17.herokuapp.com/problem-students

Get Co-ops by Status

Returns all coops that have the specified status. Status can be NotStarted, InProgress, Completed, or Incomplete.

  • Route: https://ecse321-group17.herokuapp.com/coop-by-status/{status}
  • Example: https://ecse321-group17.herokuapp.com/coop-by-status/Completed

Get Report

Returns the report with the specified ID.

  • Route: https://ecse321-group17.herokuapp.com/report/{id}
  • Example: https://ecse321-group17.herokuapp.com/report/123

Get Reports by Status

Returns all reports that have the specified status. Status can be Unsubmitted, Submitted, Late, or Reviewed.

  • Route: https://ecse321-group17.herokuapp.com/report-by-status/{status}
  • Example: https://ecse321-group17.herokuapp.com/report-by-status/Late

Get Reports by Type

Returns all reports that have the specified type. Report type can be Contract, Technical, StudentEval, EmployerEval, or TwoWeek.

  • Route: https://ecse321-group17.herokuapp.com/report-by-type/{type}
  • Example: https://ecse321-group17.herokuapp.com/report-by-type/Contract

POST Routes

Any string parameter values with multiple words should be separated by a +, as seen in examples below.

Create Student

Creates a new student in the database.

Request Parameters:

  • email : String - the new student's email address
  • password : String - the new student's password
  • name : String - the new student's name
  • phone : String - the new student's phone number
  • studentId : Integer - the new student's ID

Route: https://ecse321-group17.herokuapp.com/student/create

Example: https://ecse321-group17.herokuapp.com/student/create?email=student@mcgill.ca&password=pw&name=Albert+Kragl&phone=7781112233&studentId=260711711

Create Employer

Creates a new employer in the database.

Request Parameters:

  • email : String - the new employer's email address
  • password : String - the new employer's password
  • name : String - the new employer's name
  • phone : String - the new employer's phone number
  • company : String - the new employer's company

Route: https://ecse321-group17.herokuapp.com/employer/create

Example: https://ecse321-group17.herokuapp.com/employer/create?email=employer@company.ca&password=pw&name=Employer+Person&phone=7781112234&company=Google

Create Co-op Administrator

Creates a new co-op administrator in the database.

Request Parameters:

  • email : String - the new administrator's email address
  • password : String - the new administrator's password
  • name : String - the new administrator's name
  • phone : String - the new administrator's phone number

Route: https://ecse321-group17.herokuapp.com/admin/create

Example: https://ecse321-group17.herokuapp.com/admin/create?email=admin@mcgill.ca&password=pw&name=Admin+Person&phone=7781112234

Create Co-op

Creates a new co-op term in the database.

Request Parameters:

  • title : String - the new co-op's title, e.g. "Software Engineer Intern"
  • stuEmail : String - the email of the student doing the co-op term
  • empEmail : String - the email of the co-op employer
  • start : String - the start date of the co-op, formatted as yyyy-mm-dd
  • end : String - the end date of the co-op, formatted as yyyy-mm-dd
  • status : CoopStatus - the co-op status (one of NotStarted, InProgress, Incomplete or Completed)
  • salaryPerHour : Integer - the salary per hour of the co-op position
  • hoursPerWeek : Integer - the number of hours of work per week
  • address : String - the address of where the student will be working

Route: https://ecse321-group17.herokuapp.com/coop/create

Example: https://ecse321-group17.herokuapp.com/coop/create?title=SWE+Intern&stuEmail=student@mcgill.ca&empEmail=employer@company.ca&start=2019-01-01&end=2019-05-01&status=NotStarted&salaryPerHour=20&hoursPerWeek=40&address=Montreal

Create Notification

Creates a single new notification object in the database.

Request Parameters:

  • text : String - the message contents of the notification
  • senderEmail : String - the email of the person sending the notification
  • stuEmail : String - the email of the student receiving the notification (optional)
  • empEmail : String - the email of the employer receiving the notification (optional)

Route: https://ecse321-group17.herokuapp.com/notification/create

Example: https://ecse321-group17.herokuapp.com/notification/create?text=This+is+a+test+notification&senderEmail=admin@mcgill.ca&stuEmail=student@mcgill.ca

Create Multiple Notifications

Creates multiple copies of a notification to send to multiple profiles.

Request Parameters:

  • text : String - the message contents of the notification
  • senderEmail : String - the email of the person sending the notification
  • stuEmail : List<String> - the list of the emails of the students receiving the notification (optional)
  • empEmail : List<String> - the list of the emails of the employers receiving the notification (optional)

Route: https://ecse321-group17.herokuapp.com/notification/create-many

Example: https://ecse321-group17.herokuapp.com/notification/create-many?text=This+is+a+test+notification&senderEmail=admin@mcgill.ca&stuEmail=student1@mcgill.ca,student2@mcgill.ca,student3@mcgill.ca

Create Report

Creates a new report object in the database. The date must be formatted as yyyy-mm-dd.

Request Parameters:

  • coopId : Integer - the ID of the report's associated co-op term
  • date : Date - the date associated with the report, formatted as yyyy-mm-dd
  • status : ReportStatus - one of Unsubmitted, Submitted, Late, Reviewed
  • type : ReportType - one of Contract, Technical, StudentEval, EmployerEval, TwoWeek

Route: https://ecse321-group17.herokuapp.com/report/create

Example: https://ecse321-group17.herokuapp.com/report/create?coopId=1&date=2019-05-01&status=Submitted&type=Contract

PUT Routes

Any string parameter values with multiple words should be separated by a +, as seen in examples below.

Update Report Status

Changes the status of a report in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • status : ReportStatus - the report's new status

Route: https://ecse321-group17.herokuapp.com/report/updateStatus

Example: https://ecse321-group17.herokuapp.com/report/updateStatus?id=7&status=Reviewed

Update Report Type

Changes the type of a report in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • type : ReportType - the report's new type

Route: https://ecse321-group17.herokuapp.com/report/updateType

Example: https://ecse321-group17.herokuapp.com/report/updateType?id=7&type=Contract

Update Report Due Date

Changes the due date of a report in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • date : Date - the report's new type

Route: https://ecse321-group17.herokuapp.com/report/updateDate

Example: https://ecse321-group17.herokuapp.com/report/updateDATE?id=7&date=03-04-2019

Update Coop Status

Changes the status of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • status : CoopStatus - the coop's new status

Route: https://ecse321-group17.herokuapp.com/coop/update

Example: https://ecse321-group17.herokuapp.com/coop/update?id=1&status=InProgress

Update Coop Title

Changes the title of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • title : String - the coop's new status

Route: https://ecse321-group17.herokuapp.com/coop/updateTitle

Example: https://ecse321-group17.herokuapp.com/coop/updateTitle?id=1&title=Intern

Update Coop Start Date

Changes the start date of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • date : Date - the coop's new start date

Route: https://ecse321-group17.herokuapp.com/coop/updateStart

Example: https://ecse321-group17.herokuapp.com/coop/updateStart?id=1&date=03-05-2019

Update Coop End Date

Changes the end date of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • date : Date - the coop's new end date

Route: https://ecse321-group17.herokuapp.com/coop/updateEnd

Example: https://ecse321-group17.herokuapp.com/coop/updateEnd?id=1&date=03-05-2019

Update Coop Address

Changes the address of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • address : String - the coop's new address

Route: https://ecse321-group17.herokuapp.com/coop/updateAddress

Example: https://ecse321-group17.herokuapp.com/coop/updateAddress?id=1&address=Montreal

Update Coop Pay

Changes the hourly pay of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • pay : Integer - the coop's new pay per hour

Route: https://ecse321-group17.herokuapp.com/coop/updatePay

Example: https://ecse321-group17.herokuapp.com/coop/updatePay?id=1&pay=21

Update Coop Hours

Changes the hours per week of a coop in the database.

Request Parameters:

  • id : Integer - the ID of the report
  • hours : Integer - the coop's new hours per week

Route: https://ecse321-group17.herokuapp.com/coop/updateHours

Example: https://ecse321-group17.herokuapp.com/coop/updateHours?id=1&hours=40

DELETE Routes

Any string parameter values with multiple words should be separated by a +, as seen in examples below.

Delete Report

Deletes a report from the Database.

Request Parameters:

  • id : Integer - the ID of the report to delete

Route: https://ecse321-group17.herokuapp.com/report/delete

Example: https://ecse321-group17.herokuapp.com/report/delete?id=7

Delete Coop

Deletes a coop from the Database.

Request Parameters:

  • id : Integer - the ID of the coop to delete

Route: https://ecse321-group17.herokuapp.com/coop/delete

Example: https://ecse321-group17.herokuapp.com/coop/delete?id=7

Delete Student

Deletes a student from the Database.

Request Parameters:

  • email : String - the email of the student to delete

Route: https://ecse321-group17.herokuapp.com/student/delete

Example: https://ecse321-group17.herokuapp.com/student/delete?email=student@mcgill.ca