As part of our project (web application), we have to design REST API to manage the users of our application. Our API will be based on a company user management product (I will call it: C.U.M.) that manages all users of all company applications (for each application we have a specific group).
So by definition: a user of our application necessarily exists in C.U.M. under a very specific group, with other information in its own DB(as the birth date for example).
In order to create a user for our application, you have to go through several steps. during the first step, the user enter his: first name, last name, birthdate and email.
Before being able to proceed to the next step, you must do the following checks based on the email address as a research criterion:
case 1: user doesn't exist in C.U.M. ==> Ok => step 2
case 2: a user exists in C.U.M. for another application (different group) ==> error message 1
case 3: a user of our application exists in C.U.M.(our application group) with different information (first name, last name, birth date) ==> error message 2
case 4: a user of our application exists in C.U.M.(our application group) with the same information (first name, last name, birth date) ==> go to user modification step
How can we design my RESTful API to handle these cases? can I use the options verb by exploiting the body to handle these different cases, otherwise how can I choose my uri in this case?
I thought of this solution: create an email search uri (GET /users?email="zzzz") and do the necessary checks on the front side. But, the problem in this case, that I will not be able to tell the difference between case 1 and case 2. Since in both cases I am not supposed to find any user...