Using the API to auto fill Deputy shifts

The Deputy API allows you to automatically fill shifts within a Deputy schedule by simply providing a few parameters. These include the areas and times for which the shifts should be filled, the start time for the week of shifts (e.g. midnight on the first day of the business's working week), and the end time for the auto fill shift generation process. With this information, the API can handle the rest of the shift fill process for you.

Auto filling shifts via the Deputy API

Once you have the information required you can follow the below guide to start this process.

URL

curl --request POST --url 'https://{install}.{geo}.deputy.com/api/v1/supervise/roster/autofill'

Sample Payload

{
  arrRosterIds: [1,2],
  arrEmpIds: [1,2,3,4,5],
  searchDepth: 10,
  config: [
  'cost' => 1,
  'equality' => 1,
  'prevmatch' => 1,
],
}

Data Elements

Data ElementInfo
arrRosterIdsAn array of roster id's to include in the auto fill generation process. Up to 1,000 can be provided at a time. This is a mandatory field
arrEmpId'sAn array of employee id's to include in the auto fill generation process. This is a mandatory field.
searchDepthThis defines how many permutations are used when defining the shifts. The higher this number the longer the process will take to complete.
Config ArrayThis array contains config options allowing you to define what is important in the shift generation process
costWhether you want to consider labor costs in the shift fill process. 1 is yes 0 is no
equalityWhether you want to try and evenly share shifts across the staff included in the employee array. 1 is yes 0 is no
prevmatchWhether you want the system to take into account preferences you had in previous auto fill generation processes. 0 is no 1 is yes.

🚧

Possible Timeouts

If you include a significant amount of data and a high searchDepth its possible the process will timeout. If this occurs, try again with a reduced data set or searchDepth

Response

This API works in an async manner. When you get a response from the API after a successful POST, a token will be returned that can be used to check the on how far the auto fill process has progressed. The token is in a format like this automagic638d57d4320dc.

You can check on the progress of the auto fill process with this token. Follow the below guide

URL

curl --request GET --url 'https://{install}.{geo}.deputy.com/api/v1/supervise/roster/checkautofill/{tokenid}

This will return you a number between 1 and 100. If the number is 100, the process is complete and the filled shifts should be visible in the Deputy install.