Skip to main content
All CollectionsAPI
Calculate Available Task slots endpoint
Calculate Available Task slots endpoint
eLogii avatar
Written by eLogii
Updated over 8 months ago

The endpoint https://api-35.elogii.com/optimization/calculateAvailableTaskSlots is useful when determining which driver can fit a task within a specific time window.

The endpoint achieves this by taking as input a payload request containing information about the time windows during which tasks need to be performed. It then processes this information and returns the ID of the driver(s) who are available to complete tasks within those time windows.

The endpoint returns the driver's ID(s) that match the criteria specified in the payload request, indicating which driver(s) can accommodate tasks within the specified time windows.

Request

Sample payload

{
"dateRange": {
"startDate": 20240422,
"endDate": 20240422,
"timeWindows": [
{
"start": 720,
"end": 780
},
{
"start": 840,
"end": 900
},
{
"start": 900,
"end": 960
},
{
"start": 1020,
"end": 1080
},
{
"start": 1080,
"end": 1140
}
]
},
"task": {
"pickup": {
"location": {
"address": "193-195 Sloane Street",
"postCode": "SW1X 9QX",
"city": "London",
"coordinates": [
-0.1596676,
51.5005214
]
},
"duration": 10
},
"duration": 10,
"size": {
"Package": 1
},
"location": {
"address": "126B Saint Asaph Road",
"postCode": "SE4 2EN",
"city": "London"
}
}
}

Sample response

[
{
"date": 20240422,
"timeWindows": [
{
"start": 720,
"end": 780,
"driver": "65f0b7a52b05f6dd5127e9bf",
"driverUID": "DR-5HWG8HZY",
"efficiencyScore": 0
},
{
"start": 840,
"end": 900,
"driver": "65f0b7a52b05f6dd5127e9bf",
"driverUID": "DR-5HWG8HZY",
"efficiencyScore": 0
},
{
"start": 900,
"end": 960,
"driver": "65f0b7a52b05f6dd5127e9bf",
"driverUID": "DR-5HWG8HZY",
"efficiencyScore": 0
},
{
"start": 1020,
"end": 1080,
"driver": "65f0b7a52b05f6dd5127e9bf",
"driverUID": "DR-5HWG8HZY",
"efficiencyScore": 0
},
{
"start": 1080,
"end": 1140,
"driver": "65f0b7a52b05f6dd5127e9bf",
"driverUID": "DR-5HWG8HZY",
"efficiencyScore": 0
}
]
}
]

When setting up tasks based on the response received, it’s important to maintain the task details i.e time windows and and driver schedule/exceptions to conform with the payload and results you initially got from the calculateAvailableTaskSlots endpoint.

Did this answer your question?