Fleet API

The Bestmile orchestration platform allows an operator to configure the supply of a transportation service through the explicit definition of resources and their availabilities.

Resources

A resource is identified with a UUID and can have a set of properties that are relevant for the Bestmile matching engine.

Let’s start with the creation of a resource with a seating capacity of 4.

   curl --location --request POST 'api.sandbox.bestmile.com/fleet/v1/resources' \
   --header 'Content-Type: application/json' \
   --header 'apiKey: <api key provided by Bestmile>' \
   --data-raw '{
       "fleetID": "<the fleetID value provided by Bestmile>",
       "properties": {
           "seatingCapacity": 4,
           "routingContextID": "<the routing context value provided by Bestmile>"
       }
   }'

Availabilities

Availabilities are entities defining a schedule for resources.

The platform supports Recurring and Non-recurring availability definitions. Recurring availabilities has lower precedence than non-recurring definitions.

Non-recurring are one-time availability or unavailability for a resource (depending on the isAvailable Boolean field) and they take precedence on any recurring definition when partially or completely overlapping the time period.

Unavailability takes precedence over everything else (see diagram below for an illustration of all of this).

We will call the Bestmile Fleet API to create an availability definition for the previously created resource. We specify a start DateTime and a duration as well a the start and finish locations (which would refer to a depot, a garage, or a staging area such as a parking space). The min and max possible duration of availabilities are 15 minutes and 24 hours (inclusive) respectively.

   curl --location --request POST 'api.sandbox.bestmile.com/fleet/v1/availabilities' \
   --header 'Content-Type: application/json' \
   --header 'apiKey: <api key provided by Bestmile>' \
   --data-raw '{
       "resourceID": "<UUID of the resource created previously>",
       "interval": {
           "start": "2020-07-06T19:00:31Z",
           "duration": "PT4H"
       },
       "locations": {
           "start": {
               "lat": 46.514993,
               "lon":  6.610224
           },
           "finish": {
               "lat": 46.514993,
               "lon":  6.610224
           }
       },
       "isAvailable": true
   }'