Cargo Vessels Tracking with API

AIS Tracking, API Knowledge zone

cargo vessels tracking with API

Cargo Vessels tracking with API with Datalastic provides a comprehensive database of cargo vessels and their properties, including information on ship subtype, IMO number, MMSI number, name, flag, length, breadth, and more. With the API, developers can easily access and retrieve this information for use in their own applications. In this guide, we will provide a step-by-step guide on how to find and filter cargo vessels using the Cargo Vessel API endpoint.

Step 1: Obtain an API key:

You will need to obtain an API key to use the Datalastic Cargo Vessels API. You can do this by signing up for an account. It’s important to keep your API key private and secure. Do not share it with anyone or include it in publicly accessible code.

That’s it! You now have an API key that you can use to make requests to the Datalastic Cargo Vessels API. In the next step, we will show you how to use the Cargo Vessel endpoint to find and filter cargo vessels.

Step 2: Make a rquest to Cargo Vessels API:

The Cargo Vessel endpoint is used to search for and retrieve information on vessels in the database. It is accessed via the following URL:

https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&{PARAMETER}={PARAMETER_VALUE}

To make a request to the endpoint, you will need to replace “{YOUR_API_KEY}” with your actual API key, and specify any desired parameters and their values.

Here’s an example of how you might make a request to the Cargo Vessel API using a programming language such as Python:

import requests  # Replace {YOUR_API_KEY} with your actual API key
api_key = "{YOUR_API_KEY}"  # Set up the URL with the desired parameters
url = "https://api.datalastic.com/api/v0/vessel_find?api-key={}&type=cargo".format(api_key)  # Send the request and retrieve the response
response = requests.get(url)  # Check the status code to make sure the request was successful
if response.status_code == 200:
 # The request was successful, so we can parse the response data
 data = response.json()
else:
 # The request was not successful, so we need to handle the error
 print("An error occurred: {}".format(response.status_code)) 

Parameters for Cargo Vessels API:

This code sends a GET request to Cargo Vessel API with the “type” parameter set to “cargo”, indicating that we want to find only cargo vessels. The response from the API is stored in the “response” object, which we can then use to check the status code and parse the response data.

Keep in mind that the Cargo Vessel endpoint supports many other parameters in addition to “type”, including “country”, “subtype”, “year_built”, and “gross_tonnage_max”.

Here is a complete list of the parameters and values that you can use with the Datalastic Cargo Vessels API’s Vessel Finder endpoint:

Api-key: Your API key, which you can obtain by signing up for a free account.

Type: The type of vessel you want to find.

Valid values include:

Type_specificDescription
cargoCargo vessels
fishingFishing vessels
militaryMilitary vessels
passengerPassenger vessels
pleasurePleasure vessels
sailingSailing vessels
tugTugboats
otherOther types of vessels

Type_specific: A subtype of vessel you want to find. This parameter can be used on its own or in combination with the type parameter.

Valid values include:

Type_specificDescription
bulk_carrierBulk carriers
cargo_generalGeneral cargo vessels
cargo_reeferReefer cargo vessels
cargo_ro-roRoll-on/roll-off cargo vessels
chemical_tankerChemical tankers
container_shipContainer ships
dredgerDredgers
dry_cargo_bargeDry cargo barges
gas_tankerGas tankers
livestock_carrierLivestock carriers
oil_tankerOil tankers
ore_carrierOre carriers
passenger_shipPassenger ships
passenger_ferryPassenger ferries
reeferReefers
ro-roRoll-on/roll-off ships
sailing_vesselSailing vessels
tugTugboat

You can find a list of all possible types and subtypes combinations here https://datalastic.com/api-reference/#ships-type-list

You can further add more filters to narrow down your search in Cargo Vessel API:

ParameterDescription
vehicle_carrierVehicle carriers
country_isoThe two-letter ISO code of the country of the vessels
gross_tonnage_minThe minimum gross tonnage of the vessels
gross_tonnage_maxThe maximum gross tonnage of the vessels
deadweight_minThe minimum deadweight of the vessels
deadweight_maxThe maximum deadweight of the vessels
length_minThe minimum length of the vessels
length_maxThe maximum length of the vessels
breadth_minThe minimum breadth of the vessels
breadth_maxThe maximum breadth of the vessels
year_built_minThe minimum year that the vessels were built
year_built_maxThe maximum year that the vessels were built

You can find a full list of available parameters in the API documentation.

In the next step, we will show you how to filter the results by vessel type.

Step 3: Filter the results by Type:

To filter the results by vessel type, you will need to use the “type” parameter. The “type” parameter specifies the type of vessel you want to find. 

For example, to find only cargo vessels, you can use the following URL:

https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo

This will return a list of all cargo vessels in the database.

You can use the “type” parameter in combination with other parameters to further filter the results.

For example, to find only cargo vessels with a gross tonnage between 50,000 and 100,000 tons, you can use the following URL:

https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&gross_tonnage_min=50000&gross_tonnage_max=100000

Step4: Optional: Add optional parameters to further filter the results:

In addition to the “type” parameter, the Datalastic Cargo Vessels API supports several other parameters that you can use to filter the results. These parameters allow you to search for vessels with specific characteristics, such as a particular IMO number, a specific gross tonnage, or a specific length.

Here are a few examples of how you might use additional parameters to further filter the results:

To find only cargo vessels with a gross tonnage between 50,000 and 100,000 tons, you can use the following URL:

https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&gross_tonnage_min=50000&gross_tonnage_max=100000

If you want to find only cargo vessels with a specific Country, you can use the following URL:

https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&country_iso={COUNTRY_ISO}

For only cargo vessels with a minimum Gross Tonnage Weight, you can use the following URL:

https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&gross_tonnage_min={GROSS_TONNAGE _MIN}

You can find a full list of available parameters and their values in the API documentation.

Step 5: Parse and use the results:

Once you have made your request to the Cargo Vessel API endpoint and received a response from the API, you will need to parse the results and use the data as needed in your application.

The Cargo Vessel API endpoint will return the results in JSON format. You can parse the results using your preferred method for handling JSON data in your programming language of choice.

Here’s an example of how you might parse the results and filter for only vessels in the “cargo” type that are registered in China:

Step 6: Optional: Use other options and parameters:

import json  # Parse the JSON data
data = json.loads(response.text)  # Access the results
vessels = data["results"]  # Iterate through the results and print the IMO number and flag of each vessel
for vessel in vessels:
 if vessel["type"] == "cargo" and vessel["flag"] == "CN":
 print("IMO: {}\tFlag: {}".format(vessel["imo"], vessel["country_iso"])) 

This code parses the JSON data returned by the API and stores it in a Python dictionary. It then accesses the “results” field of the dictionary, which contains a list of vessels. It then iterates through the list and checks the “type” and “flag” fields of each vessel.

Read Other Maritime Articles 

Ship Owners Types: A Comprehensive Overview

Ship Owners Types: A Comprehensive Overview

Ship owners play a pivotal role in the maritime industry. They range from individuals to expansive corporations, responsible for hiring crews and managing the ship's journey. In this article we will unveiling how to uncover data about these owners and pinpoint the...

How to Find Vessels in Rotterdam Port

How to Find Vessels in Rotterdam Port

Find Vessels in Rotterdam Port: Rotterdam, the heartbeat of maritime Europe, is more than just a port. It's a crossroads for global trade, and a testament to human engineering. Rotterdam is equipped with state-of-the-art technology for managing and tracking vessels....

Real-Time Vessel Tracking: The Benefits and Use Cases

Real-Time Vessel Tracking: The Benefits and Use Cases

Real-time vessel tracking is a technology that allows businesses and individuals to monitor the movements of ships and boats in near real time. This is made possible through the use of vessel tracking systems, which use a combination of GPS, satellite, and other...

Ship Engines Data: Master Maritime Engine Insights

Ship Engines Data: Master Maritime Engine Insights

In the ever-evolving maritime industry, real-time and historical data play a pivotal role in decision-making and operational efficiency. Datalastic Vessel Engines Data emerges as a prime resource, offering comprehensive information through a versatile API subscription...

Navigating Vessel Detentions: Success with Maritime Data API

Navigating Vessel Detentions: Success with Maritime Data API

In the ever-evolving world of maritime operations, the ability to swiftly and effectively manage inspections and detentions is crucial. One notable success story in this realm comes from a logistics firm that harnessed the power of our comprehensive vessel data API to...