This resource allows clients to create, read, update, and delete voyage events for specific voyages. Voyage events represent different activities or milestones that occur during a voyage.

Supported Formats

json

GET /api/v1/voyages/:voyage_number/voyage_events

Returns all voyage events for a specific voyage with pagination actions at the beginning of response.

Supported Formats

json

Errors

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

Examples

# Get all voyage events (default: page 1, 25 per page)
# Response includes 'actions' object with pagination URLs for easy navigation
curl 'https://app.octopi.co/api/v1/voyages/V001/voyage_events' \
  -X 'GET' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token token=YOURTOKEN'

# Get 100 events per page (maximum allowed)
curl 'https://app.octopi.co/api/v1/voyages/V001/voyage_events?per_page=100' \
  -X 'GET' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token token=YOURTOKEN'

# Get specific page with custom per_page
curl 'https://app.octopi.co/api/v1/voyages/V001/voyage_events?page=2&per_page=50' \
  -X 'GET' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token token=YOURTOKEN'

{
  "actions": {
    "previous": {
      "url": "https://app.octopi.co/api/v1/voyages/V001/voyage_events?page=0",
      "method": "GET"
    },
    "next": {
      "url": "https://app.octopi.co/api/v1/voyages/V001/voyage_events?page=2",
      "method": "GET"
    },
    "last": {
      "url": "https://app.octopi.co/api/v1/voyages/V001/voyage_events?page=3",
      "method": "GET"
    },
    "index": {
      "url": "https://app.octopi.co/api/v1/voyages/V001/voyage_events",
      "method": "GET"
    }
  },
  "voyage": {
    "id": 123,
    "voyage_number": "V001",
    "vessel_name": "MSC LORETO"
  },
  "voyage_events": [
    {
      "id": 1,
      "event_name": "Pilot Boarded",
      "event_type_id": 5,
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z",
      "started_at": "2024-01-15T10:30:00Z",
      "completed_at": "2024-01-15T11:00:00Z",
      "custom_value": null,
      "service_boat": {
        "id": 2,
        "name": "Pilot Boat Alpha"
      },
      "pilot": {
        "id": 3,
        "name": "John Smith"
      },
      "user": {
        "id": 4,
        "name": "Jane Doe"
      },
      "notes": "Pilot boarding completed successfully"
    },
    {
      "id": 2,
      "event_name": "Vessel Berthing",
      "event_type_id": 3,
      "created_at": "2024-01-15T11:15:00Z",
      "updated_at": "2024-01-15T11:15:00Z",
      "started_at": "2024-01-15T11:15:00Z",
      "completed_at": "2024-01-15T11:45:00Z",
      "custom_value": null,
      "service_boat": null,
      "pilot": {
        "id": 3,
        "name": "John Smith"
      },
      "user": {
        "id": 4,
        "name": "Jane Doe"
      },
      "notes": "Vessel successfully berthed at terminal"
    }
  ]
}

Params

Param name Description
voyage_number
required

The voyage number to retrieve events for

Validations:

  • Must be a String

page
optional

Page number for pagination

Validations:

  • Must be a Integer

per_page
optional

Number of items per page (max 100)

Validations:

  • Must be a Integer


POST /api/v1/voyages/:voyage_number/voyage_events

Creates a new voyage event for a specific voyage.

Supported Formats

json

Errors

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

Examples

curl 'https://app.octopi.co/api/v1/voyages/V001/voyage_events' \
  -X 'POST' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token token=YOURTOKEN' \
  -d '{
    "voyage_event_type_id": 5,
    "voyage_event": {
      "started_at": "2024-01-15T10:30:00Z",
      "completed_at": "2024-01-15T11:00:00Z",
      "service_boat_id": 2,
      "pilot_id": 3,
      "notes": "Pilot boarding completed successfully"
    }
  }'

{
  "voyage_event": {
    "id": 1,
    "event_name": "Pilot Boarded",
    "event_type_id": 5,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z",
    "started_at": "2024-01-15T10:30:00Z",
    "completed_at": "2024-01-15T11:00:00Z",
    "custom_value": null,
    "service_boat": {
      "id": 2,
      "name": "Pilot Boat Alpha"
    },
    "pilot": {
      "id": 3,
      "name": "John Smith"
    },
    "user": {
      "id": 4,
      "name": "Jane Doe"
    },
    "notes": "Pilot boarding completed successfully"
  }
}

Params

Param name Description
voyage_number
required

The voyage number to create the event for

Validations:

  • Must be a String

voyage_event_type_id
required

The voyage event type ID

Validations:

  • Must be a Integer

voyage_event
required

Validations:

  • Must be a Hash

voyage_event[started_at]
optional

Start time in ISO 8601 format

Validations:

  • Must be a String

voyage_event[completed_at]
optional

Completion time in ISO 8601 format

Validations:

  • Must be a String

voyage_event[service_boat_id]
optional

Service boat ID

Validations:

  • Must be a Integer

voyage_event[pilot_id]
optional

Pilot ID

Validations:

  • Must be a Integer

voyage_event[from_berth_id]
optional

From berth area ID

Validations:

  • Must be a Integer

voyage_event[to_berth_id]
optional

To berth area ID

Validations:

  • Must be a Integer

voyage_event[custom_value]
optional

Custom value for the event

Validations:

  • Must be a String

voyage_event[notes]
optional

Additional notes

Validations:

  • Must be a String


PATCH /api/v1/voyages/:voyage_number/voyage_events/:id

Updates an existing voyage event.

Supported Formats

json

Errors

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

Examples

curl 'https://app.octopi.co/api/v1/voyages/V001/voyage_events/1' \
  -X 'PATCH' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token token=YOURTOKEN' \
  -d '{
    "voyage_event": {
      "started_at": "2024-01-15T10:35:00Z",
      "completed_at": "2024-01-15T11:05:00Z",
      "notes": "Updated pilot boarding information"
    }
  }'

{
  "voyage_event": {
    "id": 1,
    "event_name": "Pilot Boarded",
    "event_type_id": 5,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:36:00Z",
    "started_at": "2024-01-15T10:35:00Z",
    "completed_at": "2024-01-15T11:05:00Z",
    "custom_value": null,
    "service_boat": {
      "id": 2,
      "name": "Pilot Boat Alpha"
    },
    "pilot": {
      "id": 3,
      "name": "John Smith"
    },
    "user": {
      "id": 4,
      "name": "Jane Doe"
    },
    "notes": "Updated pilot boarding information"
  }
}

Params

Param name Description
voyage_number
required

The voyage number that owns this event

Validations:

  • Must be a String

id
required

The voyage event ID

Validations:

  • Must be a Integer

voyage_event
required

Validations:

  • Must be a Hash

voyage_event[started_at]
optional

Start time in ISO 8601 format

Validations:

  • Must be a String

voyage_event[completed_at]
optional

Completion time in ISO 8601 format

Validations:

  • Must be a String

voyage_event[service_boat_id]
optional

Service boat ID

Validations:

  • Must be a Integer

voyage_event[pilot_id]
optional

Pilot ID

Validations:

  • Must be a Integer

voyage_event[from_berth_id]
optional

From berth area ID

Validations:

  • Must be a Integer

voyage_event[to_berth_id]
optional

To berth area ID

Validations:

  • Must be a Integer

voyage_event[custom_value]
optional

Custom value for the event

Validations:

  • Must be a String

voyage_event[notes]
optional

Additional notes

Validations:

  • Must be a String


DELETE /api/v1/voyages/:voyage_number/voyage_events/:id

Deletes a specific voyage event.

Supported Formats

json

Errors

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

Examples

curl 'https://app.octopi.co/api/v1/voyages/V001/voyage_events/1' \
  -X 'DELETE' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token token=YOURTOKEN'

{
  "message": "Voyage event deleted successfully"
}

Params

Param name Description
voyage_number
required

The voyage number that owns this event

Validations:

  • Must be a String

id
required

The voyage event ID

Validations:

  • Must be a Integer