This resource lets clients find, create, update or list truck drivers truck driver information.

Supported Formats

json

GET /api/v1/truck_drivers.json
Returns 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" : [
    {
      "id": 123,
      "fullname": "Adena Bergnaum",
      "license_number": "ABC529",
      "twic": "",
      "number": "56",
      "active": true,
      "date_of_birth": null,
      "telephone_number": "",
      "email": "adena.bergnaum@gmail.com",
      "remarks": "Best driver in town",
      "trucking_company": "Blue Trucks",
      "allowed_until": null,
      "created_at": "2020-05-01T11:33:23Z",
      "updated_at": "2023-08-10T12:36:03Z"
    },
    {
      "id": 456,
      "fullname": "Roman Mraz",
      "license_number": "DEF428",
      "twic": null,
      "number": "57,
      "active": true,
      "date_of_birth": null,
      "telephone_number": null,
      "email": "roman.mraz@gmail.com",
      "remarks": null,
      "trucking_company": "Red Trucks",
      "allowed_until": null,
      "created_at": "2019-01-28T12:23:49Z",
      "updated_at": "2023-01-28T12:23:49Z"
    },
  ],
  "actions" : {
    "index" : {
      "url" : "https://app.octopi.co/api/v1/truck_drivers",
      "method" : "GET"
    },
    "next" : {
      "url" : "https://app.octopi.co/api/v1/truck_drivers.json?page=2",
      "method" : "GET"
    },
    "previous" : {
      "method" : "GET",
      "url" : "https://app.octopi.co/api/v1/truck_drivers.json?page=0"
    },
    "last" : {
      "method" : "GET",
      "url" : "https://app.octopi.co/api/v1/truck_drivers.json?page=3"
    }
  }
}

Params

Param name Description
firstname
optional

Filter truck drivers by first name

Validations:

  • Must be a String

lastname
optional

Filter truck drivers by last name

Validations:

  • Must be a String

twic
optional

Filter truck drivers by TWIC

Validations:

  • Must be a String

license_number
optional

Filter truck drivers by license number

Validations:

  • Must be a String

number
optional

Filter truck drivers by number

Validations:

  • Must be a String

email
optional

Filter truck drivers by email

Validations:

  • Must be a String

active
optional

If set to true, will return active truck drivers. If set to false, it will return inactive truck drivers. If this parameter is absent, Octopi will return both active and inactive truck drivers.

Validations:

  • Must be a String


POST /api/v1/truck_drivers.json
Create a new truck driver.

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 a String

last_name
required

The last name of the driver.

Validations:

  • Must be a String

license_number
required

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

Validations:

  • Must be a String

number
optional

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

Validations:

  • Must be a String

trucking_company_name
optional

Name of the trucking company for the driver.

Validations:

  • Must be a String


PATCH /api/v1/truck_drivers/:number.json
Update a truck driver's information.

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 a String

last_name
required

The last name of the driver.

Validations:

  • Must be a String

license_number
required

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

Validations:

  • Must be a String

number
optional

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

Validations:

  • Must be a String

trucking_company_name
optional

Name of the trucking company for the driver.

Validations:

  • Must be a String


GET /api/v1/truck_drivers/:number.json
Show a truck driver's information.

Returns data for a driver. The number used in the URL path can be the truck driver’s license number or truck driver 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_drivers/1234.json" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOURTOKEN"