1. Home
  2. Docs
  3. Employee Sync
  4. Update Employee Data
  5. PUT Structure for Updating Info

PUT Structure for 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

PUT https://api.7shifts.com/v1/users/5252552

Request body

{
    "user": {
        "firstname": "Bertram",
        "lastname": "Gilfoyle",
        "mobile_phone": 3065558888
    }
}

Please note the following about the above request:

  • The request URL must specify the user.id of the 7shifts user to be updated
  • This request may only be used if the user’s role, department or location assignment hasn’t changed
  • 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:

GET https://api.7shifts.com/v1/users/5252552

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:

{
    "user": {
        "firstname": "Bertram",
        "lastname": "Gilfoyle",
        "mobile_phone": 3065558888,
        "email": "bertie.gilfoyle@piedpiper.com"
    }
}