Retrieving the list of existing labor model rules

As an API developer, before creating any new labor models in the Deputy account, you should always check what labor models may have already been setup within the application. This is due to the fact that you cannot have over lapping labor models and your requests will be rejected if one already exists in the location, area or time that your application is trying to add or update.

To do this, simply send a GET request to this url

URL

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

You will then get a response like the following

Sample Response

{
    "data": [
        {
            "id": "1",
            "area": 1,
            "metric": "Sales",
            "metricValueType": "currency",
            "metricAmount": "10.00",
            "laborAmount": 1,
            "minLabor": 1,
            "maxLabor": 3,
            "coverage": 2,
            "steps": [
                {
                    "from": 11,
                    "to": 20,
                    "laborAmount": 2
                }
            ],
            "maxMetricAmount": 21,
            "timeframe": 1,
            "useBuffers": true,
            "buffers": {
                "open": {
                    "hours": 1,
                    "minutes": 0,
                    "direction": "before"
                },
                "close": {
                    "hours": 1,
                    "minutes": 0,
                    "direction": "after"
                }
            },
            "subMetric": "forecast",
        }
    ],
    "success": true,
}

For each labor rule setup within the defined location, an entry will appear in the data array. This example uses a range based labor model.

ElementData TypeInfo
idStringThe name of the labor model
areaIntegerThe integer of the area in the location which is associated with the labor rule.
metricStringThe name of the metric which is being applied to the labor model rule.
metricValueTypeStringThe type of the metric being applied to the labor model, either currency or unit.
metricAmountStringThe initial ending amount for the range. For example with 10.00 the range will be 0-10.00
laborAmountIntegerThe amount of labor required in this range
minLaborIntegerThe minimum labor to put on when this range is met.
maxLaborIntegerThe maximum labor to put on when this range is met.
coverageInteger
stepsarrayThis array contains the objects which define the other ranges which form part of the labor model
steps - fromIntegerThe start of the range
steps - toIntegerThe end of the range
steps - laborAmountIntegerThe labor amount to use when this range is met in the calculations.
maxMetricAmountIntegerThe maximum amount the range should be calculated on even if the numbers exceed it.
timeframeInteger
useBuffersBoolean true/falseWhether this labor model has buffers included within it.
buffersObjectsThe buffers element includes objects which define the buffers that have been set for this labor model.
buffers - openObjectThis object contains information about the opening buffer which has been defined.
open - hoursIntegerThe number of hours to include in the opening buffer
open - minutesIntegerThe number of minutes to include in the opening buffer
open - directionStringAs this is the opening buffer this is always before
buffers - closeObjectThis object contains information about the closing buffer which has been defined.
close - hoursIntegerThe number of hours to include in the closing buffer
close - minutesIntegerThe number of minutes to include in the closing buffer
close - directionStringAs this is the closing buffer this is always after
subMetricStringWhether the labor model is using actual or forecast data for the calculations.
successboolean true/falseWhether the request to get the data was successful. In the instance where no labor rules exist, you will still get a response with this element to indicate that the API request was successful but there was no data found.