Use this API resources to CRUD trucks.

Supported Formats

json

GET /api/v1/trucks
Returns a list of trucks

This API endpoint will allow you to get a list of trucks. You can filter by using different query parameters such as license_plate or truck_driver.

Supported Formats

json

Errors

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

Examples

curl "https://app.octopi.co/api/v1/trucks.json?license_plate=Octopi" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
  "trucks": [
      {
          "id": 123,
          "active": true,
          "display_name": "00000 (Trucking Company: ABC TRANSPORT)",
          "year": null,
          "trucking_company": {
            "name": "ABC TRANSPORT",
            "code": null,
          },
          "truck_driver": {
            "fullname": "John Doe",
            "license_number": "ABC1234",
            "number": "356396"
          },
          "created_at": "2018-05-23T16:00:26Z",
          "updated_at": "2020-01-27T19:24:30Z"
      },
      {
          "id": 456,
          "active": true,
          "display_name": "00001 (Trucking Company: ABC TRANSPORT)",
          "year": null,
          "trucking_company": {
            "name": "ABC TRANSPORT",
            "code": null,
          },
          "created_at": "2020-07-17T23:19:32Z",
          "updated_at": "2021-06-17T05:02:26Z"
      },
      {
          "id": 789,
          "active": true,
          "display_name": "00002 (Trucking Company: XYZ TRANSPORT)",
          "year": null,
          "trucking_company": {
            "name": "XYZ TRANSPORT",
            "code": "IGG897",
          },
          "created_at": "2018-04-19T22:16:54Z",
          "updated_at": "2021-05-14T11:03:38Z"
      },

  ]
}

Params

Param name Description
license_plate
optional

Allows you to filter/search trucks by license plate

Validations:

  • Must be a String

trucking_company
optional

Allows you to filter/search trucks by trucking company

Validations:

  • Must be a String

truck_driver_number
optional

Allows you to filter/search trucks by truck driver number

Validations:

  • Must be a String

active
optional

Filter for active trucks by setting to true. Set to false to get all inactive trucks. If absent, Octopi will return both active and inactive trucks.

Validations:

  • Must be a String

page
optional

Specify which page of results to fetch. This value defaults to 1.

Validations:

  • Must be a Integer

per
optional

The number of items to be displayed. This value defaults to 10 and accepts a maximum of 100.

Validations:

  • Must be a Integer


POST /api/v1/trucks
Allows creating a new truck

This API endpoint will allow you to create new trucks within Octopi.

Supported Formats

json

Errors

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

Examples

curl --location --request POST 'https://app.octopi.co/api/v1/trucks.json'     --header 'Authorization: Bearer token_value'     --header 'Content-Type: application/json'     --data-raw '{
    "truck": {
      "license_plate": "ABC123",
      "number": "12345",
      "weight": 10000,
      "color": "#00528D",
      "make": "A",
      "model": "M",
      "year": 1987,
      "active": true
    }
}'
{
  "truck": {
    "id": 27095,
    "active": true,
    "license_plate": "ABC123",
    "number": "12345",
    "weight": 4535,
    "color": "#00528D",
    "is_mule": false,
    "allowed_until": null,
    "year": 1987,
    "make": "A",
    "model": "M",
    "created_at": "2022-06-22T09:10:16Z",
    "updated_at": "2022-06-22T09:10:16Z"
  }
}

Params

Param name Description
truck
required

Truck data

Validations:

  • Must be a Hash

truck[license_plate]
required

Truck license plate

Validations:

  • Must be a String

truck[number]
optional

Truck number

Validations:

  • Must be a String

truck[truck_driver_license_number]
optional

Truck driver’s license number

Validations:

  • Must be a String

truck[trucking_company]
optional

Trucking company’s name

Validations:

  • Must be a String

truck[weight]
optional

Truck weight in your organization’s weight unit preference

Validations:

  • Must be a Integer

truck[active]
optional

Is the truck active?

Validations:

  • Must be one of: true, false.

truck[color]
optional

Truck color hex code

Validations:

  • Must be a String

truck[make]
optional

Truck make

Validations:

  • Must be a String

truck[model]
optional

Truck model

Validations:

  • Must be a String

truck[year]
optional

Truck year

Validations:

  • Must be a Integer

truck[allowed_until]
optional

Until when is this truck allowed at the terminal? Sample valid entries: ‘2022-06-02’, ‘2/6/2022’, ‘June 2, 2022’

Validations:

  • Must be a String

truck[is_mule]
optional

Is the truck a mule?

Validations:

  • Must be one of: true, false.


PATCH /api/v1/trucks/:truck_license_number
Allows editing an existing truck

This API endpoint will allow you to edit existing trucks within Octopi.

Supported Formats

json

Errors

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

Examples

curl --location --request PATCH 'https://app.octopi.co/api/v1/trucks/:truck_license_number.json'     --header 'Authorization: Bearer token_value'     --header 'Content-Type: application/json'     --data-raw '{
  "truck": {
    "license_plate": "TEST123",
    "number": "6789",
    "weight": 12300,
    "active": false
  }
}'
{
  "truck": {
    "id": 27095,
    "active": false,
    "license_plate": "TEST123",
    "number": "6789",
    "weight": 5579,
    "color": "#00528D",
    "is_mule": false,
    "allowed_until": null,
    "year": 1987,
    "make": "A",
    "model": "M",
    "created_at": "2022-06-22T09:10:16Z",
    "updated_at": "2022-06-22T09:12:08Z"
  }
}

Params

Param name Description
truck_license_number
required

Truck license plate. This is the resource you will update.

Validations:

  • Must be a String

truck
required

Truck data

Validations:

  • Must be a Hash

truck[number]
optional

Truck number

Validations:

  • Must be a String

truck[truck_driver_license_number]
optional

Truck driver’s license number

Validations:

  • Must be a String

truck[trucking_company]
optional

Trucking company’s name

Validations:

  • Must be a String

truck[weight]
optional

Truck weight in your organization’s weight unit preference

Validations:

  • Must be a Integer

truck[active]
optional

Is the truck active?

Validations:

  • Must be one of: true, false.

truck[color]
optional

Truck color hex code

Validations:

  • Must be a String

truck[make]
optional

Truck make

Validations:

  • Must be a String

truck[model]
optional

Truck model

Validations:

  • Must be a String

truck[year]
optional

Truck year

Validations:

  • Must be a Integer

truck[allowed_until]
optional

Until when is this truck allowed at the terminal? Sample valid entries: ‘2022-06-02’, ‘2/6/2022’, ‘June 2, 2022’

Validations:

  • Must be a String

truck[is_mule]
optional

Is the truck a mule?

Validations:

  • Must be one of: true, false.


POST /api/v1/trucks/:truck_license_number/gate_out.json
Performs gate out operation for a truck with truck license number provided

Performs completion of gate out operation for the truck

Supported Formats

json

Errors

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

Examples

curl --location --request POST 'https://app.octopi.co/api/v1/trucks/:truck_license_number/gate_out.json'     --header 'Authorization: Bearer token_value'     --header 'Content-Type: application/json'     --data-raw '{
  "reason_for_incomplete": "wrong_terminal",
  "left_without_container": false,
  "container_seals": [
    {
        "container_number": "UTIU1939201",
        "seal":"ZDFDGFR1"
    },
    {
        "container_number": "TESU1293024",
        "seal":"SERERE22"
    }
    ]
}'
{
  "id": 179,
  "truck": {
      "id": 1,
      "license_plate": "TRK1",
      "number": "",
      "trucking_company_id": 1,
      "active": true,
      "allowed_until": null
  },
  "truck_driver": {
      "id": 1,
      "number": "DRIVER-1",
      "license_number": "N/A",
      "firstname": "DRIVER",
      "lastname": "ONE",
      "twic": null,
      "discarded_at": null,
      "active": true
  },
  "gated_in_at": "2022-03-25T10:08:21Z",
  "gated_out_at": "2022-03-25T10:08:49Z"
}
curl --location --request POST 'https://app.octopi.co/api/v1/trucks/:truck_license_number/gate_out.json'     --header 'Authorization: Bearer token_value'     --header 'Content-Type: application/json'     --data-raw '{
  "chassis_leaving_with_truck": ["CH101", "CH102"]
}'
{
  "id": 180,
  "truck": {
      "id": 1,
      "license_plate": "TRK1",
      "number": "",
      "trucking_company_id": 1,
      "active": true,
      "allowed_until": null
  },
  "truck_driver": {
      "id": 1,
      "number": "DRIVER-1",
      "license_number": "N/A",
      "firstname": "DRIVER",
      "lastname": "ONE",
      "twic": null,
      "discarded_at": null,
      "active": true
  },
  "gated_in_at": "2022-03-25T10:08:21Z",
  "gated_out_at": "2022-03-25T10:08:49Z"
}
{
  "error": "Truck Visit was not completed. The following container has unlifted holds: APLU1010203"
}

Params

Param name Description
truck_license_number
required

License number of the truck

Validations:

  • Must be a String

reason_for_incomplete
optional

Reason why interchanges were not completed

Validations:

  • Must be one of: wrong_terminal, paperwork, other.

left_without_container
optional

Whether the truck left without a container

Validations:

  • Must be one of: true, false.

container_seals
optional

Container seals

Validations:

  • Must be an Array of nested elements

container_seals[container_number]
required

Container number to which seal is added during gate out

Validations:

  • Must be a String

container_seals[seal]
required

Seal added to the container during gate out

Validations:

  • Must be a String

chassis_leaving_with_truck
optional

An array of chassis numbers that were used for dropping off containers and are now departing with the truck.

Validations:

  • Must be an array of any type