This resource lets clients add or update truck driver information.

Supported Formats

json

GET /api/v1/truck_drivers.json
Gets a list of truck drivers

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Resource Not Found.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_drivers.json" -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=ADD TOKEN HERE" -d '{"firstname":"John", "lastname":"Doe"}'
  {
   "truck_drivers" : [
      {
         "license_number" : "N/A",
         "twic" : 'TEST123',
         "active" : true,
         "firstname" : "JOHN",
         "lastname" : "DOE",
         "number" : "",
         "id" : 3
      },
      {
         "license_number" : "CAM12311",
         "twic" : 'AF123131',
         "active" : true,
         "firstname" : "JOHN",
         "lastname" : "BEAST",
         "number" : "",
         "id" : 4
      }
   ],
   "actions" : {
      "next" : {
         "url" : "http://localhost:3000/api/v1/truck_drivers.json?page=2",
         "method" : "GET"
      },
      "last" : {
         "method" : "GET",
         "url" : "http://localhost:3000/api/v1/truck_drivers.json?page=3"
      },
      "previous" : {
         "method" : "GET",
         "url" : "http://localhost:3000/api/v1/truck_drivers.json?page=0"
      },
      "index" : {
         "url" : "http://localhost:3000/api/v1/truck_drivers",
         "method" : "GET"
      }
   }
}

Params

Param name Description
firstname
optional

Filter truck drivers by first name

Validations:

  • Must be String

lastname
optional

Filter truck drivers by last name

Validations:

  • Must be String

twic
optional

Filter truck drivers by TWIC

Validations:

  • Must be String

license_number
optional

Filter truck drivers by license number

Validations:

  • Must be String

number
optional

Filter truck drivers by number

Validations:

  • Must be String

email
optional

Filter truck drivers by email

Validations:

  • Must be String

active
optional

If true, will return active truck drivers. If false, will return inactive truck drivers. If absent, Octopi will return both active and inactive truck drivers.

Validations:

  • Must be String


POST /api/v1/truck_drivers.json

Creates a new truck driver.

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Resource Not Found.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_drivers.json" -d '{"truck_driver": { "number": "1231NU78", "first_name": "Juan", "last_name": "Torres", "license_number": "N/A" }}' -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOURTOKEN"

Params

Param name Description
first_name
required

The first name of the driver.

Validations:

  • Must be String

last_name
required

The last name of the driver.

Validations:

  • Must be String

license_number
required

The license number of the driver or N/A if not available.

Validations:

  • Must be String

number
optional

A unique number used by the terminal to identify the driver.

Validations:

  • Must be String


PATCH /api/v1/truck_drivers/:number.json

Updates a truck driver record

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Resource Not Found.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_drivers/:number.json" -d '{"truck_driver": { "first_name": "Juan", "last_name": "Torres", "license_number": "new_license_number" }}' -X PATCH -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOURTOKEN"

Params

Param name Description
first_name
required

The first name of the driver.

Validations:

  • Must be String

last_name
required

The last name of the driver.

Validations:

  • Must be String

license_number
required

The license number of the driver or N/A if not available.

Validations:

  • Must be String

number
optional

A unique number used by the terminal to identify the driver.

Validations:

  • Must be String


GET /api/v1/truck_driver.json?number=:number&license_number=:license_number

Searches for a driver based on license number or number

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Resource Not Found.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_driver.json?number=1234" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOURTOKEN"

curl "https://app.octopi.co/api/v1/truck_driver.json?license_number=1234" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOURTOKEN"