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.

Element

Data Type

Info

id

String

The name of the labor model

area

Integer

The integer of the area in the location which is associated with the labor rule.

metric

String

The name of the metric which is being applied to the labor model rule.

metricValueType

String

The type of the metric being applied to the labor model, either currency or unit.

metricAmount

String

The initial ending amount for the range. For example with 10.00 the range will be 0-10.00

laborAmount

Integer

The amount of labor required in this range

minLabor

Integer

The minimum labor to put on when this range is met.

maxLabor

Integer

The maximum labor to put on when this range is met.

coverage

Integer

steps

array

This array contains the objects which define the other ranges which form part of the labor model

steps - from

Integer

The start of the range

steps - to

Integer

The end of the range

steps - laborAmount

Integer

The labor amount to use when this range is met in the calculations.

maxMetricAmount

Integer

The maximum amount the range should be calculated on even if the numbers exceed it.

timeframe

Integer

useBuffers

Boolean true/false

Whether this labor model has buffers included within it.

buffers

Objects

The buffers element includes objects which define the buffers that have been set for this labor model.

buffers - open

Object

This object contains information about the opening buffer which has been defined.

open - hours

Integer

The number of hours to include in the opening buffer

open - minutes

Integer

The number of minutes to include in the opening buffer

open - direction

String

As this is the opening buffer this is always before

buffers - close

Object

This object contains information about the closing buffer which has been defined.

close - hours

Integer

The number of hours to include in the closing buffer

close - minutes

Integer

The number of minutes to include in the closing buffer

close - direction

String

As this is the closing buffer this is always after

subMetric

String

Whether the labor model is using actual or forecast data for the calculations.

success

boolean true/false

Whether 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.