Fleet Management
Introduction to Fleets
The FleetManagement service provides an easy way for users to programmatically interact with the Oceanbolt API and manage their fleet resources.
A Fleet is a user defined collection of vessels. Fleets can be used to a group vessels of particular intererst (a users own fleet, or the fleet of a competitor for example).
Fleets are available in various parts of the Oceanbolt platform, facilitating for easy monitoring and querying of the vessels in the fleet.
Fleets consists of Vessels, and Vessels can be added/removed from a Fleet using either the API or the dashboard. Users can define custom metadata for the vessels when they add the vessels. This enables combining Oceanbolt data with internal data on the vessel (such as current route, operator name, current index, Vezon Imos platform link etc.).
Batch Methods
The API provides several “batch” methods, which make it easy to modify a fleet using batch operations. This can for example facilite easy updating of an organizations’s fleet list in the Oceanbolt platform.
For example the FleetManagent SDK provides the following convenience functions to easily update a fleet from the basis of a CSV sheet:
FleetManagement Client
- class oceanbolt.sdk.fleet.FleetManagement(client: APIClient)[source]
FleetManagement provides an interface to manage fleets for clients
- create_fleet()[source]
Creates a new Fleet for the current user.
- list_fleets()[source]
Lists Fleets for the current user (or fleets that are shared with the current user)
- describe_fleet()[source]
Retrieves fleet by Fleet id.
- delete_fleet()[source]
Deletes a Fleet for the current user.
- rename_fleet()[source]
Changes the name of a Fleet.
- share_fleet()[source]
Sets the shared status of the Fleet to be shared.
- unshare_fleet()[source]
Sets the shared status of the Fleet to be not shared.
- list_vessels()[source]
Retrieves list of vessels in a Fleet.
- add_vessel()[source]
Adds new vessel to a Fleet. A maximum of 1000 vessels can be added to a fleet.
- update_vessel()[source]
Updates existing metadata for a Vessel.
- delete_vessel()[source]
Removes a vessel from a Fleet.
- batch_add_vessels()[source]
Batch adds vessels into a Fleet. A maximum of 1000 vessels can be added to a fleet.
- batch_add_vessels_from_csv()[source]
Batch adds vessels into a Fleet sourced from a CSV file. A maximum of 1000 vessels can be added to a fleet.
- drop_vessels()[source]
Drops all the vessels currently in a fleet.
- replace_vessels()[source]
Replaces the existing vessels in a Fleet with a batch of new vessels. This is equivalent to first calling DropVessels and then calling BatchAddVessels. A maximum of 1000 vessels can be added to a fleet.
- replace_vessels_from_csv()[source]
Replaces the existing vessels in a Fleet with a batch of new vessels sourced from a CSV file. This is equivalent to first calling DropVessels and then calling BatchAddVessels. A maximum of 1000 vessels can be added to a fleet.
- batch_add_vessels_from_csv(fleet_id, path)[source]
Methods
Create Fleet
Create a user defined fleet
Example
fleet = FleetManagement(base_client).create_fleet(
fleet_name="my fleet"
)
Arguments
Response
- class oceanbolt.com.fleetmanagement_v3.types.Fleet(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]
Fleet resource
- fleet_id
The Fleet identifier.
- Type:
- fleet_name
The name of the Fleet.
- Type:
- platform
The platform identifier of the fleet
- Type:
- owner_user_id
The user id of the Fleet owner (the user who has created the Fleet).
- Type:
- organization
The organization that the user belongs to.
- Type:
- vessels_in_fleet
The number of vessels in the Fleet.
- vessels
List of Vessels in the Fleet.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.Vessel]
- shared_with_org
A flag indicating whether this is a shared fleet.
List Fleets
Lists all user defined fleets
Example
fleets = FleetManagement(base_client).list_fleets()
Arguments
None
Response
- class oceanbolt.com.fleetmanagement_v3.types.Fleets(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]
Response object for listing Fleets
- fleets
List of user defined Fleet resources.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.Fleet]
- organization_fleets
List of organizational Fleet resources that are shared with the current user.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.Fleet]
- predefined_fleets
List of system level predefined Fleet resources.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.Fleet]
Describe Fleet
Retrieves a user defined fleet
Example
fleet = FleetManagement(base_client).describe_fleet(
fleet_id="<fleet_id>"
)
Arguments
Response
- class oceanbolt.com.fleetmanagement_v3.types.Fleet(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]
Fleet resource
- vessels_in_fleet
The number of vessels in the Fleet.
- vessels
List of Vessels in the Fleet.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.Vessel]
A flag indicating whether this is a shared fleet.
Delete Fleet
Deletes a user defined fleet
Example
FleetManagement(base_client).delete_fleet(fleet_id="<fleet-id>")
Arguments
Response
None
Rename Fleet
Renames a user defined fleet
Example
FleetManagement(base_client).rename_fleet(fleet_id="<fleet-id>",new_fleet_name="new name")
Arguments
Response
- class oceanbolt.com.fleetmanagement_v3.types.Fleet(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]
Fleet resource
- fleet_id
The Fleet identifier.
- Type:
- fleet_name
The name of the Fleet.
- Type:
- platform
The platform identifier of the fleet
- Type:
- owner_user_id
The user id of the Fleet owner (the user who has created the Fleet).
- Type:
- organization
The organization that the user belongs to.
- Type:
- vessels_in_fleet
The number of vessels in the Fleet.
- vessels
List of Vessels in the Fleet.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.Vessel]
- shared_with_org
A flag indicating whether this is a shared fleet.
Add Vessel
Adds a vessel to a fleet. All metadata values must be strings.
Example
vessel = FleetManagement(base_client).add_vessel(
fleet_id="<fleet_id>",
vessel={
"imo":1234567,
"metadata":{
"key":"value"
}
}
)
Arguments
Response
- class oceanbolt.com.fleetmanagement_v3.types.Vessel(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]
Vessel object
- metadata
Metadata object that contains arbitrary data fields defined by the user.
- status
Vessel status (livestate data).
- Type:
oceanbolt.com.fleetmanagement_v3.types.VesselStatus
- stoppage_events
Vessel speed events (stoppage data).
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.VesselStoppageEvent]
- class MetadataEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)
Delete Vessel
Deletes a vessel from a fleet
Example
FleetManagement(base_client).delete_vessel(
fleet_id="<fleet_id>",
imo=1234567
)
Arguments
Response
None
Batch Add Vessels
Batch adds new vessels from a fleet. All metadata values must be strings.
Example
FleetManagement(base_client).batch_add_vessels(
fleet_id="<fleet_id>",
vessels=[
{
"imo":1234567,
"metadata":{
"key":"value"
},
{
"imo":7654321,
"metadata":{
"key":"other_value"
}
]
)
Arguments
Response
None
Batch Add Vessels From CSV
Batch adds new vessels from a fleet sourced from a CSV file. A maximum of 1000 vessels can be added to a fleet.
The csv file must have a column named ‘imo’.
Example
Example of csv file my_fleet_list.csv:
imo |
my_key |
other_key |
my_link |
---|---|---|---|
1234567 |
val |
some value |
|
7654321 |
another val |
some other value |
FleetManagement(base_client).batch_add_vessels_from_csv(
fleet_id="<fleet_id>",
path="path/my_fleet_list.csv"
)
Arguments
Response
None
Drop Vessels
Removes all vessels from a fleet
Example
FleetManagement(base_client).drop_vessels(
fleet_id="<fleet_id>"
)
Arguments
Response
None
Replace Vessels
Replaces the existing vessels in a Fleet with a batch of new vessels. This is equivalent to first calling DropVessels and then calling BatchAddVessels. A maximum of 1000 vessels can be added to a fleet. All metadata values must be strings.
Example
FleetManagement(base_client).replace_vessels(
fleet_id="<fleet_id>",
vessels=[
{
"imo":1234567,
"metadata":{
"key":"value"
},
{
"imo":7654321,
"metadata":{
"key":"other_value"
}
]
)
Arguments
- class oceanbolt.com.fleetmanagement_v3.types.BatchVesselsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]
Request object for batch adding Vessels to a Fleet
- fleet_id
Identifier of the Fleet resource where vessels should be added.
- Type:
- vessels
List of Vessels to be added.
- Type:
MutableSequence[oceanbolt.com.fleetmanagement_v3.types.VesselParams]
Response
None
Replace Vessels From CSV
Replaces the existing vessels in a Fleet with a batch of new vessels sourced from a CSV file. This is equivalent to first calling DropVessels and then calling BatchAddVessels. A maximum of 1000 vessels can be added to a fleet.
The csv file must have a column named ‘imo’.
Example
Example of csv file my_fleet_list.csv:
imo |
my_key |
other_key |
my_link |
---|---|---|---|
1234567 |
val |
some value |
|
7654321 |
another val |
some other value |
FleetManagement(base_client).replace_vessels_from_csv(
fleet_id="<fleet_id>",
path="path/my_fleet_list.csv"
)
Arguments
Response
None