Get assignments by product

This endpoint returns the assignments for a product within a period not exceeding 31 days.

GET /api/v2/business/{businessId}/products/{productId}/assignments/from/{yyyy-MM-dd}/to/{yyyy-MM-dd}

If the data included in the request is correct —both the businessId and the productId—, the response will contain the product assignments for that period.

Below is a snippet of the response:

[
    {
        "product": "0001-G",
        "blockedType": "NONE",
        "person": "1006352",
        "day": "2024-09-17",
        "presence": {
            "worked": false,
            "timeFrames": [
                {
                    "startMinuteDay": 0,
                    "duration": 1440,
                    "paid": false,
                    "worked": false
                }
            ]
        }
    },
    {
        "product": "0001-G",
        "blockedType": "NONE",
        "person": "222",
        "day": "2024-09-16",
        "presence": {
            "worked": true,
            "timeFrames": [
                {
                    "startMinuteDay": 525,
                    "duration": 60,
                    "paid": true,
                    "location": {
                        "color": "#5fe7d5",
                        "description": "Daily truck unloading",
                        "name": "Unloading",
                        "shortName": "DTU",
                        "requiredLevel": 3,
                        "priority": 5,
                        "maxResources": 2,
                        "type": "FIXED",
                        "shouldAvoidOvercover": true,
                        "system": false,
                        "category": "OPERATIONAL",
                        "product": "0001-G",
                        "id": "08"
                    },
                    "worked": true
                },
                {
                    "startMinuteDay": 600,
                    "duration": 300,
                    "paid": true,
                    "location": {
                        "color": "#007dea",
                        "name": "Fitting rooms",
                        "shortName": "FR",
                        "requiredLevel": 1,
                        "priority": 5,
                        "maxResources": 3,
                        "type": "VARIABLE",
                        "shouldAvoidOvercover": false,
                        "system": false,
                        "category": "OPERATIONAL",
                        "product": "0001-G",
                        "id": "07"
                    },
                    "worked": true
                }
            ]
        }
    }
]

The first assignment in the example corresponds to a rest day, as the worked field in the presence object is false. Additionally, it only has one timeFrame with no associated task, which spans the entire day, and both the paid and worked fields are also marked as false.

In the second assignment of the example, the worked field is true, and the characteristics of the tasks performed by the employee are indicated in each timeFrame. The level of detail in the response will depend on the configuration established in the business for different tasks.

Considerations

If there are no assignments for the specified time period, the request will return an empty array [].

If the product specified in the URL does not exist in the business, the request will return a 404 Not Found error, specifying in the message not exists.

If the time range specified in the URL exceeds 30 days, the request will return a 406 Not Acceptable error, specifying the message The request exceeded the maximum number of days allowed.

What is an assignment?

What is a task?