Schedule Rule Set Assignments
Schedule rule sets contain the restrictions and requirements that ensure a schedule meets certain criteria and include employee and organizational rules.
You can assign, update, delete, and retrieve details about schedule rule set assignments using operations against the /v1/commons/persons/schedule_rule_sets
resource.
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
In this example, we assign, verify, update, and delete a person's schedule rule set assignments.
Create the assignment
The create request:
- uses {personId} in the URL and
personIdentity
in the request body to identify the person using their person ID and person number - uses the
assignments
array to define the schedule rule sets to assign - uses
ruleSet
andcontext
to define each schedule rule set - uses
effectiveDate
to define the effective date of each assignment- Note: while the call accepts
expirationDate
, it always sets the "End of Time" expiration date of 3000-01-01
- Note: while the call accepts
Example request
Call PUT /v1/commons/persons/schedule_rule_sets/100
with the following request payload.
{
"personIdentity": {
"personNumber": "20190"
},
"assignments": [
{
"ruleSet": {
"qualifier": "Full Time Emp Rule Set"
},
"context": {
"qualifier": "DEFAULT"
},
"effectiveDate": "2020-02-10"
}
]
}
Example response
A success response returns HTTP status code 200 and a response body similar to the following example.
{
"personIdentity": {
"personKey": 100,
"personNumber": "20190"
},
"assignments": [
{
"ruleSet": {
"id": 54,
"qualifier": "Full Time Emp Rule Set"
},
"context": {
"id": -1,
"qualifier": "DEFAULT"
},
"effectiveDate": "2020-02-10",
"expirationDate": "3000-01-01"
}
]
}
Verify the assignment
To verify, call GET /v1/commons/persons/schedule_rule_sets?person_number={personNumber}&context_id={contextId}
.
Calling GET /v1/commons/persons/schedule_rule_sets?person_number=20190&context_id=-1
returns:
{
"personIdentity": {
"personKey": 100,
"personNumber": "20190"
},
"assignments": [
{
"ruleSet": {
"id": 54,
"qualifier": "Full Time Emp Rule Set"
},
"context": {
"id": -1,
"qualifier": "DEFAULT"
},
"effectiveDate": "2020-02-10",
"expirationDate": "3000-01-01"
}
]
}
Update the assignment
To update the person's schedule rule override assignments, call PUT /v1/commons/persons/schedule_rule_sets/100
with the following request payload.
This PUT operation behaves like a PATCH and adds the additional work rule set assignments to the employee's existing assignments. You cannot pass the existing assignments in the PUT payload without generating an error.
Example request
{
"personIdentity": {
"personNumber": "20190"
},
"assignments": [
{
"ruleSet": {
"qualifier": "USA-EX"
},
"context": {
"qualifier": "DEFAULT"
},
"effectiveDate": "2020-03-10"
}
]
}
Example response
{
"personIdentity": {
"personKey": 100,
"personNumber": "20190"
},
"assignments": [
{
"ruleSet": {
"id": 54,
"qualifier": "Full Time Emp Rule Set"
},
"context": {
"id": -1,
"qualifier": "DEFAULT"
},
"effectiveDate": "2020-02-10",
"expirationDate": "2020-03-10"
},
{
"ruleSet": {
"id": 9,
"qualifier": "USA-EX"
},
"context": {
"id": -1,
"qualifier": "DEFAULT"
},
"effectiveDate": "2020-03-10",
"expirationDate": "3000-01-01"
}
]
}
Delete an assignment
To delete the schedule rule set assignments associated with a person, call PUT /v1/commons/persons/schedule_rule_sets/100
with the following request payload.
{
"personIdentity": {
"personNumber": "20190"
},
"assignmentSpan": ""
}
The system returns HTTP status 200 with the following response body:
{
"personIdentity": {
"personKey": 100,
"personNumber": "20190"
},
"assignments": []
}
Updated over 1 year ago