Vehicle Filters
Vehicle filters can be used to assign specific vehicles to a task or a trip. This functionality is available both in the Dispatch API as well as the Fleet Planner API.
Dispatch API
While creating a task using the CreateTask endpoint, the vehicleFilter
option in dispatchParameters
can be set to a list of vehicles that can be assigned to this trip. Only a vehicle present in this list will be assigned to the requested task.
curl --request POST https://api.rideos.ai/dispatch-tasks/v3/CreateTask \
--header "Content-Type: application/json" \
--header "X-Api-Key: $RIDEOS_API_KEY" \
--data '{"taskId":"task-1","fleetId":"fleet-test","taskDefinition":{"pickupDropoffTask":{"uniqueResourcePickup":{"pickupLocation":{"position":{"latitude":37.794682,"longitude":-122.41148}},"uniqueResource":{"requiredCapacities":[{"capacityType":"seats","value":2}],"metadata":{"data":{"rider-name":"Rider test 1","rider-phone":"123-4567","rider-url":"web.com"}}}},"dropoff":{"position":{"latitude":37.802372,"longitude":-122.418729}}},"dispatchParameters":{"vehicleFilter":[{"vehicleId":"vehicle-1"}]},"requestorId":"rider-1"}}'
Fleet Planner API
The GetPlan
endpoint of the Fleet Planner API allows users to exclude and allow vehicles from being assigned to tasks. These filters are optional and are assigned per task.
Exclude vehicles
Fleet Planner will never assign a task to excluded vehicles set in the excludedVehicleId
field under tasks
. Excluded vehicles will override allowed vehicles.
curl --request POST https://api.rideos.ai/fleet/v2/GetPlan \
--header "Content-Type: application/json" \
--header "X-Api-Key: $RIDEOS_API_KEY" \
--data '{"vehicles": {"vehicle-0": {"resourceCapacity": 4, "vehicleId": "vehicle-0", "position": {"latitude": 37.78861129958993, "longitude": -122.42121679763515}}, "vehicle-1": {"resourceCapacity": 3, "vehicleId": "vehicle-1", "position": {"latitude": 37.77361129958993, "longitude": -122.42121679763515}}}, "tasks": {"task-0": {"resourcesRequired": 1, "pickupStep": {"position": {"latitude": 37.788710054546385, "longitude": -122.42034205962396}}, "dropoffStep": {"position": {"latitude": 37.79878236715864, "longitude": -122.4222166856741}}, "excludedVehicleId": ["vehicle-0"]}, "task-1": {"resourcesRequired": 1, "pickupStep": {"position": {"latitude": 37.78883349777378, "longitude": -122.41859090561832}}, "dropoffStep": {"position": {"latitude": 37.79900453502346, "longitude": -122.42068402876973}}}}}'
Allow vehicles
Fleet Planner will only assign vehicles present in the allowedVehicleId
field under tasks
to the corresponding task. Allowed vehicles will be overriden by excluded vehicles.
curl --request POST https://api.rideos.ai/fleet/v2/GetPlan \
--header "Content-Type: application/json" \
--header "X-Api-Key: $RIDEOS_API_KEY" \
--data '{"vehicles": {"vehicle-0": {"resourceCapacity": 4, "vehicleId": "vehicle-0", "position": {"latitude": 37.78861129958993, "longitude": -122.42121679763515}}, "vehicle-1": {"resourceCapacity": 3, "vehicleId": "vehicle-1", "position": {"latitude": 37.77361129958993, "longitude": -122.42121679763515}}}, "tasks": {"task-0": {"resourcesRequired": 1, "pickupStep": {"position": {"latitude": 37.788710054546385, "longitude": -122.42034205962396}}, "dropoffStep": {"position": {"latitude": 37.79878236715864, "longitude": -122.4222166856741}}, "allowedVehicleId": ["vehicle-1"]}, "task-1": {"resourcesRequired": 1, "pickupStep": {"position": {"latitude": 37.78883349777378, "longitude": -122.41859090561832}}, "dropoffStep": {"position": {"latitude": 37.79900453502346, "longitude": -122.42068402876973}}}}}'