Skip to content

RESTful Service Endpoints

Catherine Van Gheluwe edited this page Mar 19, 2021 · 22 revisions

AdministrativeAssistant Rest Controller

Create AdministrativeAssistant (POST)

URL Mapping:

  • This operation adds a new AdministrativeAssistant to the database and returns an AdministrativeAssistantDto object.
  • Requires a JSON object containing "name":{value 1}, "password":{value 2}, "phone":{value 3}, "email":{value 4}. The values must be non-Null and respect the rules layed out in the QA report.

Edit AdministrativeAssistant (GET)

URL Mapping:

  • This operation updates an existing AdministrativeAssistant in the database and returns the updated AdministrativeAssistantDto object.
  • Requires a JSON object containing "oldemail":{value 1}, "name":{value 2}, "password":{value 3}, "phone":{value 4}, "email":{value 5}. The values must be non-Null and respect the rules layed out in the QA report.

Appointment Rest Controller

Create Appointment (POST)

URL Mapping:

  • This operation adds a new Appointment to the database and returns an AppointmentDto object
  • Requires a JSON object containing "customerId":{value 1}, "timeSlotId":{value 2}, "carId":{value 3}, "note":{value 4}. The values must be non-Null and respect the rules layed out in the QA report. The default value for "note" is "" (empty string).

Edit Appointment (PUT)

URL Mapping:

  • This operation updates an existing Appointment in the database and returns the updated AppointmentDto object.
  • Requires a JSON object containing "customerId":{value 1}, "timeSlotId":{value 2}, "carId":{value 3}, "note":{value 4}. The values must be non-Null and respect the rules layed out in the QA report.

Get All Appointments (GET)

URL Mapping:

  • This operation returns all the Appointments in the database.
  • Queries the database and returns all the Appointments in the database as a List of AppointmentDtos
  • Requires no input.

Get Appointment By Id (GET)

URL Mapping:

  • Queries the database and returns all appointments with a certain id in the database as a list of AppointmentDtos.
  • It requires a string input that specifies the id we want to search in the database.

Add Mechanic To Appointment (POST)

URL Mapping:

  • This operation finds the TimeSlot given its timeSlotId, the Customer given its customerId, and the Mechanic given its mechanicId.
  • Then add the Mechanic to the Appointment.
  • Requires a JSON object containing “mechanicId”:{value 1}, “timeSlotId”:{value 2}, “customerId”:{value 2}.
  • This operation will throw an exception if the mechanicId is not valid.
  • This operation will throw an exception if the timeSlotId is not valid.
  • This operation will throw an exception if the customerId is not valid.

Add Image To Appointment (POST)

URL Mapping:

  • This operation finds the Image given its imageUrl, the TimeSlot given its timeSlotId, and the Customer given its customerId.
  • Then add the Image to the Appointment.
  • Requires a JSON object containing “imageUrl”:{value 1}, “timeSlotId”:{value 2}, “customerId”:{value 2}.
  • This operation will throw an exception if the imageUrl is not valid.
  • This operation will throw an exception if the timeSlotId is not valid.
  • This operation will throw an exception if the customerId is not valid.

Add Service To Appointment(POST)

URL Mapping:

  • This operation finds the TimeSlot given its timeSlotId, the Customer given its customerId, and the Service given its serviceType.
  • Then add the Service to the Appointment.
  • Requires a JSON object containing “serviceType”:{value 1}, “timeSlotId”:{value 2}, “customerId”:{value 2}.
  • This operation will throw an exception if the serviceType is not valid.
  • This operation will throw an exception if the timeSlotId is not valid.
  • This operation will throw an exception if the customerId is not valid.

Car Rest Controller

Create Car (POST)

URL Mapping:

  • This operation adds a new Car to the database and returns a CarDto object.
  • Requires a JSON object containing "customerId":{value 1}, "carTypte":{value 2}, "winderTires":{value 3}, "numOfKilometers":{value 4}. The values must be non-Null and respect the rules layed out in the QA report.

Get Cars By Customer (GET)

URL Mapping:

  • Queries the database and returns all Cars with a certain customerId in the database as a list of CarDtos.
  • It requires a string input that specifies the customerId we want to search in the database.

Customer Rest Controller

Create Customer (POST)

URL Mapping:

  • This operation adds a new Customer to the database and returns a CustomerDto object.
  • Requires a JSON object containing "name":{value 1}, "password":{value 2}, "phone":{value 3}, "email":{value 4}, "credit":{value 5}, "debit":{value 6}, "address":{value 7}. The values must be non-Null and respect the rules layed out in the QA report.

Edit Customer (PUT)

URL Mapping:

  • This operation updates an existing Customer in the database and returns the updated CustomerDto object.
  • Requires a JSON object containing "oldemail":{value 1}, "newEmail":{value 2}, "newPassword":{value 3}, "newPhone":{value 4}, "newCredit":{value 5}, "newDebit":{value 6}, "newAddress":{value 7}. The values must be non-Null and respect the rules layed out in the QA report.

Get All Customers (GET)

URL Mapping:

  • This operation returns all the Customers in the database.
  • Queries the database and returns all the Appointments in the database as a List of CustomerDtos
  • Requires no input.

Get Customer By Id (GET)

URL Mapping:

  • Queries the database and returns a Customer with a certain id in the database as a CustomerDto.
  • It requires a string input that specifies the id we want to search in the database.

Edit Cars For Customer (PUT)

  • Finds a Car from the database given an carId and a Customer given a customerEmail.
  • Then if "addRemove" is "add", adds the Appointment to Customer.
  • Then if "addRemove" is "remove", removes the Appointment from Customer.
  • Requires a JSON object containing "carId":{value1},"customerEmail":{value2}, "addRemove": {value3}.

Edit Appointment For Customer (PUT)

  • Finds an Appointment from the database given an appointmentId and a Customer given a customerId.
  • Then if "addRemove" is "add", adds the Appointment to Customer.
  • Then if "addRemove" is "remove", removes the Appointment from Customer.
  • Requires a JSON object containing "appointmentId":{value1},"customerId":{value2}, "addRemove": {value3}.

Edit AllCustomerCredentials For Customer (PUT)

  • Finds a Customer from the database given an oldEmail.
  • This operation updates an existing Mechanic in the database and returns the updated CustomerDto object.
  • Requires a JSON object containing "oldEmail":{value1},"newEmail":{value2}, "newPassword": {value3}, "newPassword": {value4}, "newPhone": {value5}, "newCredit": {value6}, "newDebit": {value7}.

Image Rest Controller

Create Image (POST)

URL Mapping:

  • This operation adds a new Image to the database and returns an ImageDto object
  • Requires a JSON object containing "url":{value 1}, "appointmentId":{value 2}. The values must be non-Null and respect the rules layed out in the QA report.

Get Image By URL (GET)

URL Mapping:

  • Queries the database and returns an Image with a certain URL in the database as an ImageDto.
  • It requires a string input that specifies the URL we want to search in the database.

Mechanic Rest Controller

Create Mechanic (POST)

URL Mapping:

  • This operation adds a new Mechanic to the database and returns a MechanicDto object
  • Requires a JSON object containing "name":{value 1}, "password":{value 2}, "phone":{value 3}, "email":{value 4}. The values must be non-Null and respect the rules layed out in the QA report.

Edit Mechanic (PUT)

URL Mapping:

  • This operation updates an existing Mechanic in the database and returns the updated MechanicDto object.
  • Requires a JSON object containing "oldemail":{value 1}, "name":{value 2}, "password":{value 3}, "phone":{value 4}, "email":{value 5}. The values must be non-Null and respect the rules layed out in the QA report.

Get All Mechanics (GET)

URL Mapping:

  • This operation returns all the Mechanics in the database
  • Queries the database and returns all the Appointments in the database as a List of MechanicDtos
  • Requires no input

Get Mechanic By Id (GET)

URL Mapping:

  • Queries the database and returns a Mechanic with a certain id in the database as a MechanicDto.
  • It requires a string input that specifies the id we want to search in the database.

Edit Service For Mechanic (PUT)

URL Mapping:

  • Finds an Service from the database given an serviceType and a Mechanic given a oldEmail.
  • Then if "addRemove" is "add", adds the Service to Mechanic.
  • Then if "addRemove" is "remove", removes the Service from Mechanic.
  • Requires a JSON object containing "serviceType":{value1},"addRemove":{value2}, "oldEmail": {value3}.

Service Rest Controller

Create Service (POST)

URL Mapping:

  • This operation adds a new Service to the database and returns a ServiceDto object
  • Requires a JSON object containing "serviceType":{value 1}, "price":{value 2}. The values must be non-Null and respect the rules layed out in the QA report.

Get All Services (GET)

URL Mapping:

  • This operation returns all the Services in the database
  • Queries the database and returns all the Appointments in the database as a List of ServiceDtos
  • Requires no input

Get Service By Service Type (GET)

URL Mapping:

  • Queries the database and returns a Service with a certain serviceType in the database as a ServiceDto.
  • It requires a string input that specifies the serviceType we want to search in the database.

Edit Mechanic For Service (PUT)

URL Mapping:

  • Finds an Appointment from the database given an appointmentId and a Mechanic given a mechanicId.
  • Then if "addRemove" is "add", adds the Mechanic to the Service.
  • Then if "addRemove" is "remove", removes the Mechanic from the Service.
  • Requires a JSON object containing "mechanicId":{value1},"serviceType":{value2},"addRemove":{value3}.

Edit Appointment For Service (PUT)

URL Mapping:

  • Finds an Appointment from the database given an appointmentId and a Service given a serviceType.
  • Then if "addRemove" is "add", adds the Appointment to the Service.
  • Then if "addRemove" is "remove", removes the Appointment from the Service.
  • Requires a JSON object containing "appointmentId":{value1},"serviceType":{value2},"addRemove":{value3}.

TimeSlot Rest Controller

Crate TimeSlot (POST)

URL Mapping:

  • This operation adds a new TimeSlot to the database and returns a TimeSlotDto object
  • Requires a JSON object containing "startTime":{value 1}, "endTime":{value 2}. The values must be non-Null and respect the rules layed out in the QA report.

Edit TimeSlot (PUT)

URL Mapping:

  • This operation updates an existing TimeSlot in the database and returns the updated TimeSlotDto object.
  • Requires a JSON object containing "oldStartTime":{value 1}, "oldEndTime":{value 2}, "startTime":{value 3}, "endTime":{value 4}. The values must be non-Null and respect the rules layed out in the QA report.

GET All TimeSlot (GET)

URL Mapping:

  • This operation returns all the TimeSlots in the database
  • Queries the database and returns all the Appointments in the database as a List of TimeSlotDtos
  • Requires no input

Get TimeSlot By Id (GET)

URL Mapping:

  • Queries the database and returns a TimeSlot with a certain id in the database as a TimeSlotDto.
  • It requires a string input that specifies the id we want to search in the database.

Edit Mechanic For TimeSlot (POST)

URL Mapping:

  • Finds a Mechanic from the database given a mechanicId, and finds TimeSlot from the database given startTime and endTime.
  • Then if "addRemove" is "add", adds the Mechanic to the TimeSlot.
  • Then if "addRemove" is "remove", removes the Mechanic from the TimeSlot.
  • Requires a JSON object containing "mechanicId":{value1},"startTime":{value2},"endTime":{value3},"addRemove":{value4}.

Edit Appointment For TimeSlot (PUT)

URL Mapping:

  • Finds an Appointment from the database given an appointmentId, and finds TimeSlot from the database given startTime and endTime.
  • Then if "addRemove" is "add", adds the Appointment to the TimeSlot.
  • Then if "addRemove" is "remove", removes the Appointment from the TimeSlot.
  • Requires a JSON object containing "appointmentId":{value1},"startTime":{value2},"endTime":{value3},"addRemove":{value4}.
Clone this wiki locally