Skip to content

RESTful services API

Sophie Deng edited this page Mar 25, 2019 · 23 revisions

This is how to use our RESTful services:

Conventions

Create: "/create[name of the class]" Viewing: "/all[name of the class in plural]"

Parameters Description

CoopPositions

Parameters Description
coopId ID of the coop position to set
startDate Starting date of the coop position, formatted MM/dd/yyyy
endDate Ending date of the coop position, formatted MM/dd/yyyy
description Description of the coop position
location Location of the coop position
term School term of the coop position
status Wanted status of the coop position
public enum Status {
PENDING,
REJECTED,
COMPLETED,
FAILED,
ACCEPTED
}

Student

Parameters Description
studentId The ID of the student taking the coop position
firstName Student's first name
lastName Student's last name

Term Instructor

Parameters Description
email Email of the term instructor

Courses

Parameters Description
courseName The name of the course

CoopPositions

POST request

Create a coop position:
/createCoop?startDate&endDate&Description&location&term&studentId

Ex: http://cooperator-backend-260.herokuapp.com/createCoop?startDate=05/06/2018&endDate=08/16/2018&description=softwareintern&location=montreal&term=summer 2018&studentId=13

Set the status of a coop position: /setCoopStatus?coopId&status

Ex: http://cooperator-backend-260.herokuapp.com/setCoopStatus?coopId=13&status=PENDING

Delete a coop position: /deleteCoopPosition?coopId

Ex: http://cooperator-backend-260.herokuapp.com/setCoopStatus?coopId=13

GET request

View current coop position of a student: /allCoopsByStudent?coopId"

Ex: http://cooperator-backend-260.herokuapp.com/allCoopsByStudent?coopId=13

View all current coop positions: /allCurrentCoops

View all coop positions: /allCoops

Course

POST request

Create a new course: /createCourse?courseName

Ex: http://cooperator-backend-260.herokuapp.com/createCourse?courseName=ECSE321

Delete a course: /deleteCourse?courseId

Ex: http://cooperator-backend-260.herokuapp.com/deleteCourse?courseId=1

GET request

View all the courses: /allCourses

Get the courses ranked from most useful to least: /ranking

Students

POST request

Create a new student: /createStudent?firstName&lastName

Ex: http://cooperator-backend-260.herokuapp.com/createStudent?firstName=john&lastName=apple

Attach a coop to a student: /offerCoopToStudent?studentId&coopId

Deleting one students: /deleteStudent?studentId

GET request

Get one student: /student?studentId

Get all the problematic students: /problematicStudents

Get all students assigned to a term instructor: /allStudentsByTermInstructor?email

Get all students: /allStudents

Employer

Create a new Employer: /createEmployer

Documents

For all create, these are the parameters

Parameters Description
name Name of the document
dueDate Due date of the document, formatted MM/dd/yyyy
coopId Id of the document it should be attached to
reportType The type of report the student should submit
ReportType {
TWO_WEEKS,
TERM_SPECIFIC,
EVALUATION
}
employerId ID of the related employer
grade Boolean: true = passed, false = fail

POST request

Create a form: /createForm?name&dueDate&coopId

Create a contract: /createEmployerContract?name&dueDate&coopId

Create a report: /createReport?name&dueDate&coopId&reportType&employerId

Ex: http://cooperator-backend-260.herokuapp.com/createReport?name=second week report&dueDate=04/28/2019&13&reportType=TWO_WEEKS&employerId=1

Grade a document: /gradeDocument?documentId&grade&instructorEmail

Ex: http://cooperator-backend-260.herokuapp.com/gradeDocument?documentId=1&grade=true&[email protected]

Delete a document: /deleteDocument?documentId

GET request

View one document belonging to a coop position: /requiredDocuments?coopId

View all documents belonging to a coop position: /allRequiredDocumentByCoopPosition?coopId

Error Responses

Wrong param please enter valid information

Service error could not get information

5xx - internal server error

Clone this wiki locally