This resource allows clients to view or manipulate truck visits within Ocotpi.

Supported Formats

json

GET /api/v1/truck_visits.json
Gets a list of truck visits.

This API endpoint allows you to fetch truck visits.

Supported Formats

json

Errors

Code Description
404 Not found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_visits.json" -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=ADD TOKEN HERE" -d '{"trucking_company_id":118,"truck_id":3274,"truck_driver_id":23801,"start_date":"2020-11-25","end_date":"2020-11-26"}'
{
  "truck_visits": [
      {
          "id": 1164576,
          "truck": {
              "id": 3274,
              "license_plate": "JA1111",
              "number": "428",
              "trucking_company_id": 118,
              "active": true,
              "allowed_until": null
          },
          "truck_driver": {
              "id": 23801,
              "fullname": "John Doe",
              "license_number": "611574",
              "twic": "",
              "number": "633353",
              "active": true,
              "date_of_birth": null,
              "telephone_number": null,
              "email": null,
              "remarks": null,
              "trucking_company": "TruckingCo1",
              "allowed_until": null,
              "created_at": "2017-09-15T15:47:12Z",
              "updated_at": "2023-09-15T15:47:12Z"
          },
          "gated_in_at": "2020-11-25T22:47:55Z",
          "gated_out_at": "2020-11-25T23:14:55Z",
          "trucking_company": {
              "id": 118,
              "name": "MARTAINER, INC.",
              "code": null
          },
          "gate": {
              "id": 108,
              "name": "South Gate"
          },
          "gate_in_user": {
              "id": 709,
              "email": "email@gmail.com",
              "firstname": "firstname",
              "lastname": "lastname",
              "name": "Firstname Lastname"
          },
          "gate_out_user": {
              "id": 401,
              "email": "email2@gmail.com",
              "firstname": "firstname",
              "lastname": "lastname",
              "name": "Firstname Lastname"
          },
          "interchanges": [
              {
                  "id": 1358853,
                  "type": "interchange_in",
                  "completed": true,
                  "container": {
                      "id": 920131,
                      "number": "KOSU4921341",
                      "goods": "N/A",
                      "container_type_label": "40HC",
                      "container_status": "full"
                  },
                  "chassis": {
                      "id": 39528,
                      "number": "CAMD4370"
                  }
              },
              {
                  "id": 1358903,
                  "type": "interchange_out",
                  "completed": true,
                  "container": {
                      "id": 1956749,
                      "number": "KOSU6216253",
                      "goods": "FRESH PUMPKIN TEMP +45 F 20 % OPEN",
                      "container_type_label": "40RF",
                      "container_status": "full",
                      "operating_reefer": true,
                      "reefer_temperature": "45.1",
                      "reefer_set_point_temperature": "45.0",
                      "supply_temperature": null
                  },
                  "chassis": {
                      "id": 39849,
                      "number": "CAMD5034"
                  },
                  "genset": {
                      "id": 5895,
                      "number": "G335"
                  }
              }
          ],
          "duration": "27"
      },
      {
          "id": 1164057,
          "truck": {
              "id": 3274,
              "license_plate": "JA111",
              "number": "428",
              "trucking_company_id": 118,
              "active": true,
              "allowed_until": null
          },
          "truck_driver": {
              "id": 23801,
              "number": "611574",
              "license_number": "N/A",
              "firstname": "firstname",
              "lastname": "lastname",
              "twic": "",
              "active": true
          },
          "gated_in_at": "2020-11-25T19:17:56Z",
          "gated_out_at": "2020-11-25T20:17:28Z",
          "trucking_company": {
              "id": 118,
              "name": "MARTAINER, INC.",
              "code": null
          },
          "gate": {
              "id": 98,
              "name": "West Gate"
          },
          "gate_in_user": {
              "id": 418,
              "email": "email@gmail.com",
              "firstname": "firstname",
              "lastname": "lastname",
              "name": "Firstname Lastname"
          },
          "gate_out_user": {
              "id": 3456,
              "email": "email2@gmail.com",
              "firstname": "firstname",
              "lastname": "lastname",
              "name": "Firstname Lastname"
          },
          "interchanges": [
              {
                  "id": 1358268,
                  "type": "interchange_in",
                  "completed": true,
                  "chassis": {
                      "id": 45326,
                      "number": "CAMD7003"
                  }
              },
              {
                  "id": 1358420,
                  "type": "interchange_out",
                  "completed": true,
                  "container": {
                      "id": 920131,
                      "number": "KOSU4921341",
                      "goods": "N/A",
                      "container_type_label": "40HC",
                      "container_status": "empty"
                  },
                  "chassis": {
                      "id": 39528,
                      "number": "CAMD4370"
                  }
              }
          ],
          "duration": "60"
      }
  ]
}

Params

Param name Description
truck_id
optional

Filter truck visits associated with a truck. You can pass the truck Octopi ID or the truck license plate.

Validations:

  • Must be a String

truck_driver_id
optional

Filter truck visits associated with a truck driver. You must pass the truck driver Octopi ID.

Validations:

  • Must be a Integer

trucking_company_id
optional

Filter truck visits associated with a trucking company. You can pass the trucking company Octopi ID or the trucking company code.

Validations:

  • Must be a String

gate_ids
optional

Filter truck visits associated with gates. You must pass an array of gate Octopi IDs.

Validations:

  • Must be an array of any type

user_id
optional

Filter truck visits associated with a user. You must pass the user’s Octopi ID.

Validations:

  • Must be a Integer

container_id
optional

Filter truck visits associated with a container. You can pass the container Octopi ID or the container number.

Validations:

  • Must be a String

chassis_id
optional

Filter truck visits associated with a chassis. You can pass the chassis Octopi ID or the chassis number.

Validations:

  • Must be a String

genset_id
optional

Filter truck visits associated with a genset. You can pass the genset Octopi ID or the genset number.

Validations:

  • Must be a String

start_date
optional

Filter truck visits for which gate in occurred after the start date. Must be formatted as YYYY-MM-DD.

Validations:

  • Must be a String

end_date
optional

Filter truck visits for which gate in occurred before the end date. Must be formatted as YYYY-MM-DD.

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


GET /api/v1/truck_visits/:id
Get details of a truck visit.

Returns information about the truck visit.

Supported Formats

json

Errors

Code Description
404 Not found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_visits/123.json" -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=ADD TOKEN HERE"'
{
  "id": 123,
  "truck": {
    "id": 2787,
    "license_plate": "ABCX59",
    "number": "270",
    "trucking_company_id": 100,
    "active": true,
    "allowed_until": null
  },
  "truck_driver": {
    "id": 23801,
    "fullname": "John Doe",
    "license_number": "611574",
    "twic": "",
    "number": "633353",
    "active": true,
    "date_of_birth": null,
    "telephone_number": null,
    "email": null,
    "remarks": null,
    "trucking_company": "TruckingCo1",
    "allowed_until": null,
    "created_at": "2017-09-15T15:47:12Z",
    "updated_at": "2023-09-15T15:47:12Z"
  },
  "gated_in_at": null,
  "gated_out_at": null,
  "trucking_company": {
    "id": 118,
    "name": "MARTAINER, INC.",
    "code": null
  },
  "gate": {
    "id": 12,
    "name": "Some Gate"
  },
  "gate_in_user": {
    "id": 543,
    "email": "jim.shim@terminal.com",
    "firstname": "Jim",
    "lastname": "Shim",
    "name": "Jim Shim"
  },
  "interchanges": [],
  "duration": "0"
}

Params

Param name Description
id
required

Retrieve information regarding a specific truck visit with the truck visit’s ID in Octopi.

Validations:

  • Must be a Integer


POST /api/v1/truck_visits.json
Create a truck visit.

Creates a new TBD truck visit or truck visit with interchanges when a pre advice number is provided.

Supported Formats

json

Errors

Code Description
404 Not found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/truck_visits.json"
-d '{
      "truck_driver_number": "1231NU78",
      "gate": "North Gate",
      "truck": "ABC123",
      "comment": "Arrived early"
    }'
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Token token=YOURTOKEN"
{
  "truck_visit": {
    "id": 1876441,
    "gated_in_at": "2022-06-01T07:29:45Z",
    "gated_out_at": null
  },
  "gate_name": "North Gate",
  "truck_driver": "Agua Agua",
  "truck": "ABC123",
  "comment": "Arrived early"
}
{ "error": "Truck is already at the terminal." }

Params

Param name Description
truck_driver_id
optional

Truck driver ID. If this parameter is present, truck_driver_number and truck_driver_license will be ignored.

Validations:

  • Must be a String

truck_driver_number
optional

Truck driver number. If truck_driver_id is present, this will be ignored.

Validations:

  • Must be a String

truck_driver_license
optional

Truck driver license number. If truck_driver_id or truck_driver_number is present, this will be ignored.

Validations:

  • Must be a String

truck
required

Truck license plate number.

Validations:

  • Must be a String

gate
required

In Gate name or client identifier.

Validations:

  • Must be a String

out_gate
optional

Out Gate name or client identifier.

Validations:

  • Must be a String

comment
optional

A comment for this truck visit.

Validations:

  • Must be a String

pre_advice_number
optional

Provide Pre Advice number as stored in Octopi to create truck visit and interchanges from a pre-advice. Please note that other params except gate will be ignored when a pre-advice number is provided.

Validations:

  • Must be a String

interchanges_completed_at
optional

The date and time of completion of all the interchanges in the pre advice. Provide ISO 8601 format (Eg 2023-04-13T14:30:00Z). Providing this value will create the interchanges of truck visit with a completed status.

Validations:

  • Must be a String