Drivers API

Summary

Resource Operation Description
Drivers GET /dcs/(dc_id)/drivers/(driver_id)/driver_bulk_info Get driver metadata and location.
  PATCH /dcs/(dc_id)/drivers/(driver_id)/finish-routes Finish all active routes assigned to this driver
  PUT /dcs/(dc_id)/drivers/(driver_id)/finish-routes  
  GET /dcs/(dc_id)/drivers/(driver_id)/active-routes Get all active routes assigned to this driver
  GET /dcs/(dc_id)/drivers/(driver_id)/location Get the latest known location of this driver
  GET /dcs/(dc_id)/drivers/(driver_id) Get a driver
  PATCH /dcs/(dc_id)/drivers/(driver_id) Update a driver
  DELETE /dcs/(dc_id)/drivers/(driver_id) Delete a driver
  POST /dcs/(dc_id)/drivers Create a driver
  GET /dcs/(dc_id)/drivers Get all drivers for the dc

Details

GET /dcs/(dc_id)/drivers/(driver_id)/driver_bulk_info
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "driver": {
      "id": "the driver's id",
      "login_token": "secret-login-token",
      "name": "the driver's name"
    }
    "driver_location": {
      "timestamp": 1567702800000,
      "location": {
        "latitude": 37.7749,
        "longitude": -122.4194
      }
    }
  }
}

Please note that if the driver exists but has not reported any locations to Foxtrot, the driver_location object may be null.

PATCH /dcs/(dc_id)/drivers/(driver_id)/finish-routes
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:
PUT /dcs/(dc_id)/drivers/(driver_id)/finish-routes
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:
GET /dcs/(dc_id)/drivers/(driver_id)/active-routes
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "active_routes": [{
        "planned_start_time": 1567702800000,
        "route_id": "route id",
    }, {
        "planned_start_time": 1567731600000,
        "route_id": "route id 2",
    }]
  }
}
GET /dcs/(dc_id)/drivers/(driver_id)/location
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "driver_location": {
      "timestamp": 1567702800000,
      "location": {
        "latitude": 37.7749,
        "longitude": -122.4194
      }
    }
  }
}

Please note that if the driver exists but has not reported any locations to Foxtrot, the driver_location object may be null.

GET /dcs/(dc_id)/drivers/(driver_id)
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "driver": {
      "id": "the driver's id",
      "login_token": "secret-login-token",
      "name": "the driver's name"
    }
  }
}
PATCH /dcs/(dc_id)/drivers/(driver_id)
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Request JSON Object:
 
  • driver_name (string) – The driver’s new name
Status Codes:

Example request

{
  "driver_name": "John's new name"
}
DELETE /dcs/(dc_id)/drivers/(driver_id)
Parameters:
  • dc_id (string) – The dc id
  • driver_id (string) – The driver’s id
Status Codes:
POST /dcs/(dc_id)/drivers
Parameters:
  • dc_id (string) – The dc id
Request JSON Object:
 
  • driver_name (string) – The driver’s name
  • driver_id (string) – The driver’s id
Status Codes:
Error Code Description
2000 Driver with that id already exists.

Example request

{
  "driver_name": "John",
  "login_token": "secret-login-token",
  "driver_id": "John's id"
}
GET /dcs/(dc_id)/drivers
Parameters:
  • dc_id (string) – The dc id
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "drivers": [{
      "id": "the driver's id",
      "login_token": "secret-login-token",
      "name": "the driver's name"
    }, {
      "id": "the driver's id 2",
      "login_token": "secret-login-token",
      "name": "the driver's name 2"
    }]
  }
}