Shift Template Profile Assignments - Aggregated

Shift templates define a standard shift with common characteristics for one or many employees. You can then assign the shift to an employee or to many employees without needing to specify any characteristics.

Prerequisites

A person's person ID is the same as the personKey and employee ID, and is not the same as the person number.

The person in this example has a person ID of 100 and a person number of 20190.

Example

Create or update assignments

The create or update request:

  • uses personIdentity to identify the person using their person number
  • uses managerShiftTemplateProfile within personAssignments to define the shift template profiles to assign

Example request

Call POST /v1/commons/persons/assignments/multi_upsert with the following request payload.

[
  {
    "personIdentity": {
      "personNumber": "20190"
    },
    "personAssignments": {
      "managerShiftTemplateProfile": {
        "shiftTemplateProfile": {
          "id": -1,
          "qualifier": "All Shift Templates"
        }
      }
    }
  }
]

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

[
  {
    "personIdentity": {
      "personNumber": "20190"
    },
    "personAssignments": {
      "managerShiftTemplateProfile": {
        "shiftTemplateProfile": {
          "id": -1,
          "qualifier": "All Shift Templates"
        }
      }
    }
  }
]

Verify assignments

You can use the bulk multi-read operation to verify assignments for multiple people at once.

Example request

To verify, call POST /v1/commons/persons/assignments/multi_read with the following request payload.

{
  "where": {
    "employees": {
      "key": "personNumber",
      "values": [
        "20190"
      ]
    },
    "personAssignments": [
      "managerShiftTemplateProfile"
    ]
  }
}

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

[
  {
    "personIdentity": {
      "personNumber": "20190"
    },
    "personAssignments": {
      "managerShiftTemplateProfile": {
        "shiftTemplateProfile": {
          "id": -1,
          "qualifier": "All Shift Templates"
        }
      }
    }
  }
]

Delete assignments

You can delete, or unassign, assignments. To delete our example's assignments, call POST /v1/commons/persons/assignments/multi_upsert using the unAssignExisting property.

Example request

Call POST /v1/commons/persons/assignments/multi_upsert with the following request payload.

[
    {
        "personIdentity": {
            "personNumber": "20190"
        },
        "personAssignments": {
            "managerShiftTemplateProfile": {
                "unAssignExisting":true
            }
        }
    }
]

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

[
  {
    "personIdentity": {
      "personNumber": "20190"
    },
    "personAssignments": {
      "managerShiftTemplateProfile": {
        "shiftTemplateProfile": {
          "id": -2,
          "qualifier": "Empty Profile"
        }
      }
    }
  }
]

Note: You can verify that the assignments were deleted by calling POST /v1/commons/persons/assignments/multi_read with a request payload specifying all of the affected person identities.