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_specific | Description |
---|---|
cargo | Cargo vessels |
fishing | Fishing vessels |
military | Military vessels |
passenger | Passenger vessels |
pleasure | Pleasure vessels |
sailing | Sailing vessels |
tug | Tugboats |
other | Other 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_specific | Description |
---|---|
bulk_carrier | Bulk carriers |
cargo_general | General cargo vessels |
cargo_reefer | Reefer cargo vessels |
cargo_ro-ro | Roll-on/roll-off cargo vessels |
chemical_tanker | Chemical tankers |
container_ship | Container ships |
dredger | Dredgers |
dry_cargo_barge | Dry cargo barges |
gas_tanker | Gas tankers |
livestock_carrier | Livestock carriers |
oil_tanker | Oil tankers |
ore_carrier | Ore carriers |
passenger_ship | Passenger ships |
passenger_ferry | Passenger ferries |
reefer | Reefers |
ro-ro | Roll-on/roll-off ships |
sailing_vessel | Sailing vessels |
tug | Tugboat |
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:
Parameter | Description |
---|---|
vehicle_carrier | Vehicle carriers |
country_iso | The two-letter ISO code of the country of the vessels |
gross_tonnage_min | The minimum gross tonnage of the vessels |
gross_tonnage_max | The maximum gross tonnage of the vessels |
deadweight_min | The minimum deadweight of the vessels |
deadweight_max | The maximum deadweight of the vessels |
length_min | The minimum length of the vessels |
length_max | The maximum length of the vessels |
breadth_min | The minimum breadth of the vessels |
breadth_max | The maximum breadth of the vessels |
year_built_min | The minimum year that the vessels were built |
year_built_max | The 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
Flight API
Access real-time, historical and future dates flight API to get flight status, location, delay, route data and more. Flight APIs of Aviation Edge are useful data tools for developers with global flight data and uptime rates of 99.9%. Flight Tracking: Keep tabs...
Flight Tracker API
Get real-time aircraft location and speed data with Aviation Edge Flight Tracker API. The flight tracking data allows you to monitor an aircraft’s real-time location, speed, and status throughout its route. The API uses REST which allows a clear and simple integration...
Flight Schedules API
Flight Schedules API developed by Aviation Edge provides real-time, historical and future airport timetable data. Track departure and arrival schedules of airports worldwide. Alternatively, use an airline filter to track an airline’s flight schedule. Flight number ...
Why the Maritime API is a Must-Have?
Maritime API, a revolution in the shipping and logistics sector, have transformed the way businesses in this industry operate. They grant access to a wealth of data about ships, their journeys, and intricate details that can be leveraged to streamline operations....
Find Ships In New York Port
Finding ships in the New York Port is akin to tapping into the pulse of global commerce. Serving as the eastern gateway to the U.S., the NYC port is a bustling hub of trade. Its terminals show how important it is for worldwide links. In this article, we will identify...
Find 15 Major Maritime Ports in the World with API
Find major ports with API: In the world of maritime transportation, ports play a crucial role as key hubs for global trade and commerce. Identifying the major ports is essential for various stakeholders, including shipping companies, logistics providers, and port...
Recent Comments