Adding/Updating a Shift
If your application adds shifts to Deputy then inevitably at some point it will also need to update those shifts. The Deputy API offers the ability to remotely add shifts that are required to be filled (open) and ones already allocated to an employee.
Before you can add a shift to Deputy you will need to know for what location and area the shift are for, whether a break should be included and if the shift is already filled, the id record number for the employee who will be working it.
Adding a new shift with an employee attached to Deputy
Once you have all the information required to add a shift, follow the below guide.
URL
curl --request POST --url 'https://{install}.{geo}.deputy.com/api/v1/supervise/roster'
Sample Payload to add a shift with an employee attached.
{
"intStartTimestamp": 1663084585,
"intEndTimestamp": 1663138617,
"intRosterEmployee": 1,
"blnPublish": true,
"intMealbreakMinute": 15,
"intOpunitId": 1,
"blnForceOverwrite": 0,
"blnOpen": 0,
"strComment": "Roster via API",
"intConfirmStatus": 1
}
Data Elements
Data Element | Info |
---|---|
intStartTimestamp | The start time of the shift in unix time |
intEndTimestamp | The end time of the shift in unix time |
intRosterEmployee | The id record number of the employee to add to the shift |
blnPublish | Boolean true/false - Whether to publish the roster or not. If true, this can trigger notifications to employees about the shift so you need to be aware of that. |
intMealbreakMinute | If the shift has a meal break the length of the break in minutes |
intOpunitId | The id record number of the area the shift is for |
blnForceOverwrite | Boolean 0, 1 - If 0 will not force override an existing shift. If 1 it will do so. |
blnOpen | Boolean 0,1 - If 0 will not display the shift as open if 1 it will. |
strComment | String comment that can be added to the shift |
intConfirmStatus | Boolean 1,0 - Whether the shift has been confirmed or not. 1 If confirmed 0 if not. |
intRosterId | The id record number of the roster being updated |
API response
When adding a shift the response body will be empty but if successful a 200 HTTP response is returned.
Updating an existing shift via the API
Updating an existing roster is exactly the same request as that for adding a new one except for the record id number of the shift you want to update must be included in the payload.
Sample payload for updating a shift
{
"intRosterId":123
"intStartTimestamp": 1663084585,
"intEndTimestamp": 1663138617,
"intRosterEmployee": 1,
"blnPublish": true,
"intMealbreakMinute": 15,
"intOpUnitId": 1,
"blnForceOverwrite": 0,
"blnOpen": 0,
"strComment": "Roster via API",
"intConfirmStatus": 1,
"intConnectStatus": 2
}
Sending a notification when publishing
To send notification you would need to use the below endpoint and payload with the notification type you would like to use and roster(s) you would like to publish and send notifications for.
URL
curl --request POST --url 'https://{install}.{geo}.deputy.com/api/v1/supervise/roster/publish'
Sample payload for updating a shift
{
intMode:'1', // notification type
blnAllLocationsMode:'1',
intRosterArray:[] // Roster Id's
}
Data Elements
Data Element | Info |
---|---|
intMode | Notification type: 1 - SMS and Email 2 - SMS 3 - Email 4 - None 5- Confirmation required |
intRosterArray | Array of Roster IDs to publish |
Updated about 1 year ago