1. Home
  2. Docs
  3. Employee Sync
  4. Read Employee Data
  5. Find User Assignments

Find User Assignments

In order to establish an understanding on which roles, departments & locations (LDR) a user needs to be assigned to on your side, you will need to read the user’s relevant LDR assignments from 7shifts.

Since the mapping will have already been completed by this point, the integration should know which LDRs in 7shifts corresponds to which LDRs in your system. All that is left to figure out which LDRs the user is assigned to in 7shifts so that you can mirror the assignments in your system.

The best way to find assignment info is to get the roles that a user is assigned to, and then using that to infer what department & location the user is assigned to. Here’s an example request to get a user’s assigned roles (replace 12345 with the user’s ID):

Request

GET https://api.7shifts.com/v1/roles?user_id=12345

Response

{
    "status": "success",
    "total": 2,
    "offset": 0,
    "limit": 250,
    "data": [
        {
            "role": {
                "id": 13579,
                "location_id": 24680,
                "department_id": 36953,
                "name": "Bartender",
                ...
            },
            "station": []
        },
        {
            "role": {
                "id": 13591,
                "location_id": 24682,
                "department_id": 36917,
                "name": "Host",
                ...
            },
            "station": []
        }
    ]
}

You’ll primarily need to look at the following fields:

ParameterTypeExplanation
idNumericID of the role that the user is assigned to
nameStringName of the role that the user is assigned to
location_idNumericID of the location that the role belongs to
department_idNumericID of the department that the role belongs to

Every role object will have information on which location (location_id) & department (department_id) it belongs to. Using the ID of every role returned, along with the respective department & location IDs, you should be able to determine the LDR assignments for a user.

Please note that you might come across some rare cases where a role has a null department_id. This would be a case of a 7shifts location simply not having any departments, and only having roles directly associated to the location.