- Sort your list of people so that managers are before their direct reports, otherwise you won't be able to assign each user a manager when you add them.
- Do a GET on admin groups to get your list of admin groups and store them locally.
- Do a GET "search users" to find the employee in Appraisd using the employeeID (or email address). We suggest you set the flag to include deactivated users (see Re-hires below).
- If the user does not exist:
- POST to add a new user. You will need to supply their line manager's employeeID and their admin group ID. If there's an error, this could be because the manager could not be found. You can elect to send them a welcome email.
- If the user already exists and the relevant properties (manager, name, email etc) are different from the ones in your records, then either:
- POST the updated user in full. This will overwrite all the properties in Appraisd with those you supply including the empty properties, so make sure you supply all the properties from the original GET otherwise they will be wiped.
- or PATCH the updated user with a handful of properties. This command only overwrites the properties in Appraisd with only those you supply. Empty or null properties are not updated in Appraisd. This is how you can update a single property on a user (eg First Name) without affecting any other properties.
If you re-hire employees then you'll need to consider what you'd like to happen in Appraisd. Would you like to reactivate their original profile so they can see their previous reviews and objectives (recommended)? Or would you prefer to start fresh?
In either case, note that both employee IDs and email addresses must be unique in Appraisd, even for deactivated users. You will not be able to add a re-hired employee into Appraisd if their email address or employee ID is already in the database under a different, original user.
So, when you 'search users' in your API implementation above, make sure you set the flag to include deactivated users in your search and depending on what you'd like to do, reactivate the original user or edit the original user's email and employee ID so that you can insert a new user.