Trying to find out what is a good way to design a delete.
trying to explain using example:
I have a resource for Employee. The employee has the following fields
Employee{
String firstName
String lastName
String emailId
String managerEmployeeId
String employeeId
}
I want the ability to delete the employee using any of the fields e.g. firstName , lastName , employeeId , or managerEmployeeId
How should my resource paths look ideally
Option1: is this a good option ? yes ? no ? why ?
/employee/id/{employeeId}
/employee/firstName/{firstName}
/employee/lastName/{lastName}
/employee/managerId/{managerId}
Option2:
use of query params
/employee?id=100 ( to delete employee with id 100)
/employee?firstName=Tom&lastName=Winn (to delete an employee named Tom Winn)
/employee?managerEmployeeId=400 (delete all employees having manager id as 400)
Option 1 looks very RPC-ish to me
I like the second option but I find it very error prone since the fields have to be specified.
In the 2nd option I don't like the idea of having a param named firstName and then mapping it to a firstName field in a Java class Employee. Is this a used paradigm in the industry ?
Further this is for a backend application with xml and written in java( use of loose field names looks very un-java to me)
I would like to understand what is being followed in the industry ( specifically for a strongly typed java+xml based rest systems built in jersey , restEasy or Spring )