Running a Labor Model in Deputy

It is possible using the Deputy API to remotely execute the start of a labor model calculation. To do this you will need to know the location you want to execute the labor model for. Once you have that follow the below guide.

URL

curl --POST 'https://{install}.{geo}.deputy.com/api/v2/labor-model/location/{locationid}/run

Within the body of the request, you need to include two unix time stamps. This will define the period you want the labor model to be run for.

{
    "start": 12345678,
    "end": 12345678
}

Once you execute the API request, the labor model will begin to run. This can take a significant amount of time and it is not an async API so please keep that in mind with your infrastructure requirements. When the model has complete, you will get a JSON summary of what it has produced.

{
    "success": true,
    "data": {
        "hours": 15,
        "minutes": 20,
        "start": "1630245600",
        "end": "1630850400",
        "staffByDay": [
            {
                "date": "2021-08-30T00:00:00Z",
                "staffByArea": [
                    {
                        "area": 1,
                        "hours": 15,
                        "minutes": 20
                    }
                ]
            }
        ]
    }
}
ElementData TypeInfo
successBoolean true/falseIf the model ran successfully this will be true. False if the model encounters an error
dataObjectThis object contains information about the result of the labor model execution
hoursIntegerThe total amount of required hours the labor model has calculated in the execution
minutesIntegerThe total amount of require minutes the labor model has calculated in the execution
startStringThe starting timestamp in unix time for the labor model
endStringThe ending timestamp in unix time for the labor model
staffByDayArrayContains an object entry for each date that was included in the labor model execution
staffByDay - areaIntegerThe id of the area being referenced in this object
hoursIntegerThe total amount of hours calculated for the area
minutesIntegerThe minutes within the total hours calculated for the area. For example if its 20 hours and minutes is 45, the total is 20 hours and 45 minutes.