Vessel Tracking
Real-time Position Tracking
Our API provides real-time vessel position tracking through both REST API endpoints and WebSocket connections.
REST API
Use the position endpoint for polling:
http
GET /vessels/{imo}/positionWebSocket API
For real-time updates, connect to our WebSocket endpoint:
javascript
const ws = new WebSocket('wss://api.logistics-vessels.com/v1/vessels/live');
ws.onmessage = (event) => {
const update = JSON.parse(event.data);
console.log('Vessel update:', update);
};Historical Data
Get historical position data for any vessel:
http
GET /vessels/{imo}/historyjson
{
"imo": "9876543",
"history": [
{
"latitude": 51.8739,
"longitude": 4.2866,
"timestamp": "2024-01-20T15:30:00Z",
"speed": 14.5
}
]
}Map Integration
Our API supports direct integration with popular mapping libraries:
javascript
// Leaflet.js example
const map = L.map('vessel-map').setView([51.8739, 4.2866], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
// Add vessel marker
const marker = L.marker([51.8739, 4.2866]).addTo(map);
// Update position in real-time
api.subscribe('9876543', (update) => {
marker.setLatLng([update.latitude, update.longitude]);
});