Get assignments by service
This endpoint returns the assignments of a service within a period not exceeding 31 days.
GET /api/v2/business/{businessId}/services/{serviceId}/assignments/from/{yyyy-MM-dd}/to/{yyyy-MM-dd}
If the data included in the request is correct —businessId and serviceId— the response will contain the service assignments for that period.
Below is a snippet of the response:
[
{
"product": "0001-G",
"blockedType": "NONE",
"person": "1006355",
"day": "2024-05-02",
"presence": {
"worked": false,
"timeFrames": [
{
"startMinuteDay": 0,
"duration": 1425,
"paid": false,
"worked": false
}
]
}
},
{
"product": "0001-G",
"blockedType": "NONE",
"person": "1006355",
"day": "2024-05-04",
"presence": {
"worked": true,
"timeFrames": [
{
"startMinuteDay": 450,
"duration": 240,
"paid": true,
"location": {
"color": "#fed46b",
"description": "Perform commercial tasks: customer service, collection, orders at the point of sale...",
"name": "Sales",
"shortName": "S",
"requiredLevel": 1,
"priority": 5,
"type": "VARIABLE",
"shouldAvoidOvercover": false,
"system": false,
"category": "Operational",
"product": "0001-G",
"id": "03"
},
"worked": true
},
{
"startMinuteDay": 780,
"duration": 300,
"paid": true,
"location": {
"color": "#7f7f7f",
"description": "Creation of the workshop opening checklist",
"name": "Opening",
"shortName": "OP",
"requiredLevel": 1,
"priority": 5,
"type": "FIXED",
"shouldAvoidOvercover": false,
"system": false,
"category": "Operational",
"product": "0001-G",
"id": "01"
},
"worked": true
}
]
}
}
]
The first assignment in the example corresponds to a day off, as the worked
field in the presence is false
.
Additionally, it only has one timeFrame
with no associated task, covering the entire day, and both the paid
and worked
fields are also false
.
In the second assignment example, the worked
field in the presence is true
and it indicates the characteristics of the tasks performed by the employee in each timeFrame
.
The level of detail in the response will depend on the business configuration for the different tasks.
Considerations
If there are no assignments for the indicated period, the request will return an empty array []
.
If the service 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 interval specified in the URL exceeds 30 days, the request will return a 406 Not Acceptable
error, specifying in the message The request exceeded the maximum number of days allowed.