Skip to content

RESTful services documentation

Yichen Wu edited this page Apr 13, 2021 · 33 revisions

NOTE:

See the http status codes there: https://www.restapitutorial.com/httpstatuscodes.html
Click the Endpoints to see the Integration Testing related

AppointmentController

Request type Endpoints Method Name Method Description Inputs Outputs
GET /appointment/id
/appointment/id/
getAppointment get an appointment by ID
  • @PathVariable("id") Long id: the ID of the requested appointment
AppointmentDto
  • Success: 200
  • Failure: 400
GET /appointments/person/email
/appointments/person/email/
getAppointmentHistory get all appointments for a given customer
  • @PathVariable("email") String email: the email of the customer
List<AppointmentDto>
  • Success: 200
  • Failure: 400
PUT /appointment/id
/appointment/id/
editAppointment edit a given appointment
  • @PathVariable("id") Long id: the ID of the requested appointment
  • @RequestParam(value = "timeSlotId") Long timeSlotId: the ID of the timeslot for the updated appointment
  • @RequestParam(value = "serviceNames") List serviceNames: the list of bookable service names that the updated appointment contains
ResponseEntity<?>
  • Success: 200
  • Failure: 400
DELETE /appointment/id
/appointment/id/
deleteAppointment delete a gievn appointment
  • @PathVariable("id") Long id: the ID of the appointment to be deleted
ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /appointment
/appointment/
createAppointment create a new appointment in the datebase
  • @RequestParam(value="customerId") Long customerId: ID of the customer
  • @RequestParam(value="serivceNames") List serivceNames: list of services in the new appointment
  • @RequestBody TimeSlotDto timeSlotDto:timeslot of the new appointment
ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /appointmentNoShow/id
/appointmentNoShow/id/
enterNoShow declare no show for a given appointment
  • @PathVariable("id") Long id:appointment to be declared no show
ResponseEntity<?>
  • Success: 200
  • Failure: 400

BusinessController

Request type Endpoints Method Name Method Description Inputs Outputs
GET /business/id
/business/id/
getBusiness get the requested business
  • @PathVariable("id") Long id: ID of the requested business
ResponseEntity<?>
  • Success: 200
  • Failure:
  • 400
POST /business
/business/
createBusiness create new business in the database
  • @RequestBody BusinessDto businessDto:business to be registered
ResponseEntity<?>
  • Success: 200
  • Failure:
  • 400
PUT /business/id
/business/id/
updateBusiness updates business information
  • @PathVariable("id") Long id: ID of the business to be updated
  • @RequestBody BusinessDto businessDto: business to be updated
ResponseEntity<?>
  • Success: 200
  • Failure: 400
DELETE /business/id
/business/id/
deleteBusiness deletes the business from the system
  • @PathVariable("id") Long id: ID of the business to be deleted
ResponseEntity<?>
  • Success: 200
  • Failure: 400

PersonController

Request type Endpoints Method Name Method Description Inputs Outputs
GET /person/customer/email
/person/customer/email/
getCustomer get a customer by email
  • @PathVariable String email: the email of the requested customer
ResponseEntity<?>
  • Success: 200
  • Failure: 400
GET /person/technician/email
/person/technician/email/
getTechnician get a technician by email
  • @PathVariable String email: the email of the requested technician
ResponseEntity<?>
  • Success: 200
  • Failure: 400
GET /person/administrator/email
/person/administrator/email/
getAdministrator get an administrator by email
  • @PathVariable String email: the email of the requested administrator
ResponseEntity<?>
  • Success: 200
  • Failure: 400
PUT /person/customer/email
/person/customer/email/
updateCustomer edit the information of a customer
  • @PathVariable String email: the email of requested customer
  • @RequestBody CustomerDto customerDto: customer with updated parameters
ResponseEntity<?>
  • Success: 200
  • Failure: 400
PUT /person/technician/email
/person/technician/email/
updateTechnician edit the information of a technician
  • @PathVariable String email: the email of requested technician
  • @RequestBody TechnicianDto technicianDto: technician with updated parameters
ResponseEntity<?>
  • Success: 200
  • Failure: 400
PUT /person/administrator/email
/person/administrator/email/
updateAdministrator edit the information of an administrator
  • @PathVariable String email: the email of requested administrator
  • @RequestBody TechnicianDto technicianDto: administrator with updated parameters
ResponseEntity<?>
  • Success: 200
  • Failure: 400
DELETE /person/customer/email
/person/customer/email/
deleteCustomer delete the account for a given customer @PathVariable String email: the email of the customer account to be deleted ResponseEntity<?>
  • Success: 200
  • Failure: 400
DELETE /person/technician/email
/person/technician/email/
deleteTechnician delete the account for a given technician @PathVariable String email: the email of the technician account to be deleted ResponseEntity<?>
  • Success: 200
  • Failure: 400
DELETE /person/administrator/email
/person/administrator/email/
deleteAdministrator delete the account for a given administrator @PathVariable String email: the email of the admnistrator account to be deleted ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /person/customer/register
/person/customer/register/
createCustomer create a new customer account in the database @RequestBody CustomerDto customerDto:the customer account that want to be created ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /person/customer/login
/person/customer/login/
loginCustomer login to an existing customer account @RequestBody CustomerDto customerDto:the customer account that want to be logged in ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /person/technician/register
/person/technician/register/
createTechnician create a new technician account in the database @RequestBody TechnicianDto technicianDto:the technician account that want to be created ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /person/technician/login
person/technician/login/
loginTechnician login to an existing technician account @RequestBody TechnicianDto technicianDto:the technician account that want to be logged in ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /person/administrator/register
/person/administrator/register/
createAdministrator create a new administrator account in the database @RequestBody AdministratorDto administratorDto:the administrator account that want to be created ResponseEntity<?>
  • Success: 200
  • Failure: 400
POST /person/administrator/login
/person/administrator/login/
loginAdministrator login to an existing administrator account @RequestBody AdministratorDto administratorDto:the administrator account that want to be logged in ResponseEntity<?>
  • Success: 200
  • Failure: 400

ServiceController

Request type Endpoints Method Name Method Description Inputs Outputs
GET /bookableService/name
/bookableService/name/
getBookableService get the requested bookable service
  • @PathVariable("name") String name: the unique name of the requested business
BookableServiceDto
  • Success: 200
  • Failure: 400
GET /bookableServices
/bookableServices/
getAllBookableServices get all bookable services in the repair shop - List<BookableServiceDto>
  • Success: 200
  • Failure: 400
POST /bookableService
/bookableService/
createBookableService create new bookable service in the database
  • @RequestBody BookableServiceDto bookableServiceDto:the bookable service to be created
ResponseEntity<?>
  • Success: 200
  • Failure:
  • 400
PUT/td> /bookableService/name
/bookableService/name/
editBookableService edit a bookable service
  • @PathVariable("name") String name:the name of the requested bookable service
  • @RequestBody BookableServiceDto bookableServiceDto:the bookable service with updated parameters
ResponseEntity<?>
  • Success: 200
  • Failure:
  • 400
DELETE /bookableService/name
/bookableService/name/
deleteBookableService deletes the bookable service from the system
  • @PathVariable("name") String name: name of the bookable service to be deleted
ResponseEntity<?>
  • Success: 200
  • Failure: 400

TimeSlotController

Request type Endpoints Method Name Method Description Inputs Outputs
GET /timeslotAvailable
/timeslotAvailable/
getAvailableTimeSlots get the open timeslots - List<TimeSlot?>
  • Success: 200
  • Failure:
  • 400
POST /timeSlot
/timeSlot/
createTimeSlot create new timeslot in the database
  • @RequestBody TimeSlotdto timeSlotDto:timeslot to be registered
ResponseEntity<?>
  • Success: 200
  • Failure:
  • 400
DELETE /timeSlot/id
/timeSlot/id/
deleteTimeSlot deletes the timeslot from the system
  • @PathVariable("id") Long id: ID of the timeslot to be deleted
ResponseEntity<?>
  • Success: 200
  • Failure: 400