Update Employee Data

This section focuses on:

  • Structure of PUT requests to the /users endpoint for basic info update:
    • Get familiar with the request you need to make to update basic user data in 7shifts
  • Structure of PUT requests to the /users endpoint for assignment update:
    • Get familiar with the request you need to make to update user assignments
  • Update employee profile in 7shifts

Put structure for updating updating info

Updating user data in 7shifts is handled through a PUT request to the 7shifts /users endpoint.

This particular PUT request structure for updating basic info may only be used when any of the following has been updated for a user that has already been synced/mapped into 7shifts:

  • First name
  • Last name
  • Phone
  • Email (only if the user doesn’t already have one in 7shifts)

Keeping the field values from the POST example in mind, here’s an example PUT request to the /users endpoint to update any of the above fields:

Request URL

curl --request PUT --url 'https://api.7shifts.com/v2/company/12335/users/1111'

Request body

     "first_name": "Bertram",
     "last_name": "Gilfoyle",
     "mobile_number": "3065558888"

Please note the following about the above request:

  • The request URL must specify the id of the 7shifts user to be updated.
  • You only need to specify the fields that got updated, although it wouldn’t make a difference if you specified all the fields in the request body.

Note: If the user’s email address got updated in your system, that change should only be pushed to 7shifts if the user doesn’t already have an email address in 7shifts.

Before making a PUT request that involves changing a user’s email address, you should make the following GET request with the user’s ID and check if the email field is empty:

curl --request GET --url 'https://api.7shifts.com/v2/company/1234/users/1111'

You should proceed with updating the email address for the 7shifts user only if the email field in the response is empty. You can do so by using the same PUT request mentioned above & modifying the request body as follows:

     "first_name": "Bertram",
     "last_name": "Gilfoyle",
     "mobile_number": "3065558888",
     "email": "[email protected]" 

Updating LDR and Wage Assignments

We provide endpoints to modify locations, departments and role assignment for each user. Before you proceed you must have a clear understanding of 7shifts mapping specified in our Mapping guide. Additionally your implementation must have a synchronized table for each location, department and role ID's and how they map to your system.

Referencing the previous POST, here we provide an example PUT request to the assign the existing user to yet another role with the ID 55555 which exists under department ID 33333 at location 22222, which is another location under the same company, for a $15.00 wage:

Request URLs

curl --request POST \
	--url 'https://api.7shifts.com/api/v2/company/1234/users/1111/location_assignments' \
  --data '{"location_id":22222}'
curl --request POST \
	--url 'https://api.7shifts.com/api/v2/company/1234/users/1111/department_assignments' \
  --data '{"department_id":33333}'
curl --request POST \
	--url 'https://api.7shifts.com/api/v2/company/1234/users/1111/role_assignments' \
  --data '{"role_id":555555}'

TIP The POST /role_assignments includes logic to add a location and department if they are not assigned to the user. For the example above you only needed to make the last call to assign the location, department and role for user 1111

When removing assignments, use the DELETE action for the endpoints. NOTE deleting assignments will cascade the changes down to their children objects. If you delete a user location assignment, it will also delete the associated department and role assignments.

Example request to remove a department assignment 8256 from a user 1111:

curl --request DELETE --url https://api.7shifts.com/api/v2/company/1234/users/1111/department_assignments/8256

Changing Wage Type

Did an employee just switch from being on an hourly wage to a weekly salary? When updating the user wage you must set a new wage with the wage_type = weekly_salary with a new effective date and wage_cents value.

The same can be done when switching from weekly salary to hourly wage.

curl --request POST \
     --url 'https://api.7shifts.com/v2/company/1234/users/1111/wages' \
     --data '
     "role_id": 555555,
     "effective_date": "2022-06-01",
     "wage_type": "hourly",
     "wage_cents": 1500

Unassigning locations, departments and roles

You can use the following endpoints to remove assignments. Each endpoint will cascade the changes down so if a location is removed from a users assignments, it will remove the related departments and roles.