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.com/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,
              "number": "611574",
              "license_number": "N/A",
              "firstname": "Fname",
              "lastname": "Lname",
              "twic": "",
              "active": true
          },
          "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 String

truck_driver_id
optional

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

Validations:

  • Must be String

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 Integer

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

page
optional

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

Validations:

  • Must be Integer

per
optional

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

Validations:

  • Must be Integer


GET /api/v1/truck_visits/:id

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.com/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": 2468,
    "number": "621212",
    "license_number": "N/A",
    "firstname": "John",
    "lastname": "Doe",
    "twic": "",
    "active": true
  },
  "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 given the truck visit’s Octopi ID.

Validations:

  • Must be Integer


POST /api/v1/truck_visits.json

Creates a 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.json" -d '{"truck_driver_number": "1231NU78","gate":"North Gate","truck":"ABC123"}' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOURTOKEN"
{
    "id": 269708,
    "gated_in_at": "2018-09-05T18:41:17.422Z",
    "gated_out_at": null,
    "gate_name": "Cargo Gate (LCL)",
    "truck_driver": "Norman Greaves"
}
{"error": "Truck is already at the terminal."}

Params

Param name Description
truck_driver_number
required

Validations:

  • Must be String

truck
required

Validations:

  • Must be String

gate
required

Validations:

  • Must be String