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 

Port of Shanghai Details (CN SHG)

Port of Shanghai Details (CN SHG)

The Port of Shanghai is one of the most significant and busiest ports in the world. Located at the mouth of the Yangtze River, this port serves as a vital gateway for international trade. In this article, we will delve into the impressive scale of the port, its...

Worldwide Maritime Companies List

Worldwide Maritime Companies List

The maritime industry, often termed the backbone of global trade, handles over 90% of the world's trade volume. This industry is crucial, as it not only ensures the flow of goods across continents but also contributes to global economic stability. A Worldwide Maritime...

Understanding Ship Casualty Data

Understanding Ship Casualty Data

Every year, the maritime industry faces numerous challenges related to safety at sea. From collisions and groundings to fires and machinery failures, ship casualties not only pose significant risks to human life and the environment but also lead to substantial...

Minimize Costs with Timely Vessel ETA Data

Minimize Costs with Timely Vessel ETA Data

AIn the complex world of global logistics, the Estimated Time of Arrival (ETA) isn't just a figure—it's a crucial strategic element that drives efficiency and cost-effectiveness across the supply chain. Understanding and leveraging vessel ETA information can transform...

How Data Improves Ship Sales and Purchase Decisions?

How Data Improves Ship Sales and Purchase Decisions?

Ship Sales and Purchase drive the shipping industry, one of the world's vital economic engines. Every day, vast volumes of goods are transported across global waterways. The high stakes involved in ship transactions demand precision, efficiency, and informed...