Skip to content

brentlaster/roar

Repository files navigation

The APIs in the EmployeeController class have several parameters and return types as described below:

  1. Get All Employees

    • Endpoint: /employees/all
    • Method: GET
    • Parameters: None
    • Returns: A ResponseEntity<Object> containing a list of all Employee objects or an error message in case of failure.
  2. Search Employee by employeeId

    • Endpoint: /employees/{employeeId}
    • Method: GET
    • Parameters:
      • employeeId (Integer): The ID of the Employee to be viewed.
    • Returns: A ResponseEntity<Object> containing the Employee object with the specified employeeId or an error message in case of failure.
  3. Search for all Employees whose age is greater than input age

    • Endpoint: /employees/greaterThanAge/{age}
    • Method: GET
    • Parameters:
      • age (Integer): The age to filter employees by.
    • Returns: A ResponseEntity<Object> containing a list of Employee objects whose age is greater than the specified age or an error message in case of failure.
  4. Search for all Employees who are from input city

    • Endpoint: /employees/fromCity/{cityName}
    • Method: GET
    • Parameters:
      • cityName (String): The name of the city to filter employees by.
    • Returns: A ResponseEntity<Object> containing a list of Employee objects from the specified city or an error message in case of failure.

Each of these endpoints is designed to handle specific types of requests related to employees, utilizing path variables (@PathVariable) for dynamic input values and returning either a list of employees or a single employee wrapped in a ResponseEntity object for HTTP status and body encapsulation. The ResponseEntity object allows for flexible HTTP responses, including both the data (in this case, Employee or a list of Employee objects) and the HTTP status code, providing a clear indication of the operation's outcome (e.g., HttpStatus.OK for success or HttpStatus.INTERNAL_SERVER_ERROR for an error).

About

Example Grails demo project for use in training

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published