Skip to content

RESTful services documentation

Yichen Wu edited this page Mar 18, 2021 · 33 revisions

TODO: double-check the outputs!!!
See the http status codes there: https://www.restapitutorial.com/httpstatuscodes.html

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
  • Success:
  • Failure:
GET /appointments/person/id
/appointments/person/id/
getAppointmentHistory get all appointments for a given customer
  • @PathVariable("id") Long id: the ID of the customer
  • Success:
  • Failure:
PUT /appointment/id
/appointment/id/
editAppointment edit a given appointment
  • @PathVariable("id") Long id: the ID of the requested appointment
  • @RequestBody AppointmentDto appointmentDto: appointment with updated parameters
  • Success:
  • Failure:
DELETE /appointment/id
/appointment/id/
deleteAppointment delete a gievn appointment
  • @PathVariable("id") Long id: the ID of the appointment to be deleted
  • Success:
  • Failure:
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
  • Success:
  • Failure:
POST /appointmentNoShow/id
/appointmentNoShow/id/
enterNoShow declare no show for a given appointment
  • @PathVariable("id") Long id:appointment to be declared no show
  • Success:
  • Failure:

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
  • Success:
  • Failure:
POST /business
/business/
createBusiness create new business in the database
  • @RequestBody BusinessDto businessDto:business to be registered
  • 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
  • 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
  • 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
  • @PathVariable("name") String name: the name of the requested service
  • Success: 200
  • Failure: 400
GET /bookableServices
/bookableServices/
getTechnician get a technician by -
  • Success: 200
  • Failure: 400
GET /bookableServices
/bookableServices/
getAdministrator get an administrator by -
  • Success: 200
  • Failure: 400
GET /bookableServices
/bookableServices/
getOwner get an owner by -
  • Success: 200
  • Failure: 400
PUT /bookableService/name
/bookableService/name/
updateCustomer edit the information of a customer
  • @PathVariable("name") String name: the name of the requested bookable service
  • @RequestBody BookableServiceDto bookableServiceDto: bookable service with updated parameters
  • Success: 200
  • Failure: 400
PUT /bookableService/name
/bookableService/name/
updateTechnician edit the information of a technician
  • @PathVariable("name") String name: the name of the requested bookable service
  • @RequestBody BookableServiceDto bookableServiceDto: bookable service with updated parameters
  • Success: 200
  • Failure: 400
PUT /bookableService/name
/bookableService/name/
updateAdministrator edit the information of an administrator
  • @PathVariable("name") String name: the name of the requested bookable service
  • @RequestBody BookableServiceDto bookableServiceDto: bookable service with updated parameters
  • Success: 200
  • Failure: 400
PUT /bookableService/name
/bookableService/name/
updateOwner edit the information of an owner
  • @PathVariable("name") String name: the name of the requested bookable service
  • @RequestBody BookableServiceDto bookableServiceDto: bookable service with updated parameters
  • Success: 200
  • Failure: 400
DELETE /bookableService/name
/bookableService/name/
deleteCustomer delete the account for a given customer @PathVariable("name") String name: the name of the bookable service to be deleted
  • Success: 200
  • Failure: 400
DELETE /bookableService/name
/bookableService/name/
deleteTechnician delete the account for a given technician @PathVariable("name") String name: the name of the bookable service to be deleted
  • Success: 200
  • Failure: 400
DELETE /bookableService/name
/bookableService/name/
deleteAdministrator delete the account for a given administrator @PathVariable("name") String name: the name of the bookable service to be deleted
  • Success: 200
  • Failure: 400
DELETE /bookableService/name
/bookableService/name/
deleteOwner delete the account for a given owner @PathVariable("name") String name: the name of the bookable service to be deleted
  • Success: 200
  • Failure: 400
POST /person/customer/register
/person/customer/register/
createCustomer create a new customer account in the datebase @RequestBody CustomerDto customerDto:the customer account that want to be created
  • 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
  • Success: 200
  • Failure: 400
POST /person/technician/register
/person/technician/register/
createTechnician create a new technician account in the datebase @RequestBody TechnicianDto technicianDto:the technician account that want to be created
  • 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
  • Success: 200
  • Failure: 400
POST /person/administrator/register
/person/administrator/register/
createAdministrator create a new administrator account in the datebase @RequestBody AdministratorDto administratorDto:the administrator account that want to be created
  • 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
  • Success: 200
  • Failure: 400
POST /person/owner/register
/person/owner/register/
createOwnerr create a new owner account in the datebase @RequestBody OwnerDto ownerDto:the owner account that want to be created
  • Success: 200
  • Failure: 400
POST /person/owner/login
/person/owner/login
loginOwner login to an existing owner account @RequestBody OwnerDto ownerDto:the owner account that want to be logged in
  • Success: 200
  • Failure: 400

ServiceController

//////////// CONTINUE

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
  • Success: 200
  • Failure: 400
GET /bookableServices
/bookableServices/
getAllBookableServices get all bookable services in the repair shop -
  • Success: 200
  • Failure: 400
POST /bookableService
/bookableService/
createBookableService create new bookable service in the database
  • @RequestBody BookableServiceDto bookableServiceDto:the bookable service to be created
  • 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
  • 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
  • Success: 200
  • Failure: 400

TimeSlotController

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
  • Success:
  • Failure:
POST /business
/business/
createBusiness create new business in the database
  • @RequestBody BusinessDto businessDto:business to be registered
  • 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
  • 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
  • Success: 200
  • Failure: 400