Documentation API v1.0
API de partage de position GPS en temps réel
Créer un partage
Générer un lien de partage de position en temps réel
POST
/api/v1/shares
Description
Crée un nouveau partage de position GPS. Vous recevrez un lien unique à partager avec vos clients ou collaborateurs. Le partage peut inclure un itinéraire, des géorepérages, et une interface personnalisée.
Paramètres du body (JSON)
| Paramètre | Type | Requis | Description | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tracker_imeis |
array | Requis | Liste des IMEI des trackers à partager (minimum 1) | |||||||||||||||||||||||||||||||||
duration |
integer | null | Requis | Durée de validité en secondes (minimum 60), ou null pour infini | |||||||||||||||||||||||||||||||||
refresh_rate |
integer | Requis | Taux de rafraîchissement en secondes (minimum 5) | |||||||||||||||||||||||||||||||||
ip_whitelist |
array | Optionnel | Liste d'IP autorisées à accéder au partage | |||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
theme |
string | "light" | "dark" |
language |
string | "fr" | "en" |
hideCredits |
boolean | Masquer les crédits de la carte |
hideShareDetails |
boolean | Masquer les détails du partage |
hideControls |
boolean | Masquer les contrôles de navigation |
centerOnTracker |
boolean | Centrer automatiquement sur le tracker |
waypointMarkerUrl |
string | URL de l'icône pour les points d'étape |
clustering.enabled |
boolean | Activer le regroupement de marqueurs |
clustering.maxZoomCluster |
integer | Niveau de zoom max pour clustering (0-18) |
uiOptions.refreshButton |
boolean | Afficher le bouton de rafraîchissement |
allowedDomains |
array | Domaines autorisés (supporte wildcards *) |
route_config
object
Optionnel
Configuration de l'itinéraire
waypoints |
array | Points de passage [{lat, lng, label}] |
showRoute |
boolean | Afficher l'itinéraire sur la carte |
showAllMarkers |
boolean | Afficher tous les marqueurs des waypoints |
showEta |
boolean | Afficher l'estimation d'arrivée (ETA) |
routeColor |
string | Couleur de l'itinéraire (format HEX) |
profile |
string | "driving-car" | "driving-hgv" |
avoidFeatures |
array | ["highways", "tollways", "ferries", "fords"] |
preference |
string | "fastest" | "shortest" | "recommended" |
updateRoute |
boolean | Mettre à jour l'itinéraire en temps réel |
manualEta.departureTime |
string | Heure de départ (format "HH:MM") |
manualEta.arrivalTime |
string | Heure d'arrivée (format "HH:MM") |
display_config
object
Optionnel
Configuration de l'affichage
showSpeed |
boolean | Afficher la vitesse du véhicule |
showAddress |
boolean | Afficher l'adresse actuelle |
showCoordinates |
boolean | Afficher les coordonnées GPS |
showOrientation |
boolean | Afficher l'orientation du véhicule |
showLastUpdate |
boolean | Afficher l'heure de dernière mise à jour |
vehicle_info
object
Optionnel
Informations sur les véhicules (clé = IMEI)
name |
string | Nom du véhicule |
description |
string | Description ou statut |
icons.active |
string | URL de l'icône véhicule actif |
icons.offline |
string | URL de l'icône véhicule hors ligne |
icons.inactive |
string | URL de l'icône véhicule inactif |
statusMessage |
string | Message de statut personnalisé |
metadata |
object | Métadonnées personnalisées (clé-valeur) |
webhook_config
object
Optionnel
Configuration des webhooks
webhookUrl |
string | URL de destination pour les webhooks |
events |
array | ["geofence_enter", "geofence_exit"] |
secret |
string | Clé secrète pour signer les webhooks |
geofences |
array | Zones [{lat, lng, radius, label}] |
auto_terminate
object
Optionnel
Terminaison automatique du partage
onArrival |
boolean | Activer la terminaison à l'arrivée |
delayAfterArrival |
integer | Délai en secondes après l'arrivée |
proximityThreshold |
integer | Distance en mètres pour arrivée |
Exemples de code
PHP
<?php
$url = "https://api.fleetlize.fr/api/v1/shares";
$data = [
"tracker_imeis" => ["863130065574643"],
"duration" => 86400,
"refresh_rate" => 10,
"ip_whitelist" => ["192.168.1.1", "10.0.0.1"],
"map_config" => [
"theme" => "light",
"language" => "fr",
"hideCredits" => false,
"hideShareDetails" => false,
"hideControls" => false,
"centerOnTracker" => true,
"waypointMarkerUrl" => "https://example.com/marker.png",
"clustering" => [
"enabled" => true,
"maxZoomCluster" => 15
],
"uiOptions" => [
"refreshButton" => true
],
"allowedDomains" => ["fleetlize.fr", "*.fleetlize.fr"]
],
"route_config" => [
"waypoints" => [
["lat" => 42.768139, "lng" => 1.488861, "label" => "Départ"],
["lat" => 42.766644, "lng" => 1.48284, "label" => "Étape"],
["lat" => 42.763846, "lng" => 1.479987, "label" => "Arrivée"]
],
"showRoute" => true,
"showAllMarkers" => false,
"showEta" => true,
"routeColor" => "#FF6B00",
"profile" => "driving-car",
"avoidFeatures" => ["highways", "tollways"],
"preference" => "fastest",
"updateRoute" => true,
"manualEta" => [
"departureTime" => "08:30",
"arrivalTime" => "14:45"
]
],
"display_config" => [
"showSpeed" => true,
"showAddress" => true,
"showCoordinates" => false,
"showOrientation" => true,
"showLastUpdate" => true
],
"vehicle_info" => [
"863130065574643" => [
"name" => "Bus Ligne 12",
"description" => "Direction Gare de Lyon",
"icons" => [
"active" => "https://api.fleetlize.fr/uploads/car-placeholderGreen.png",
"offline" => "https://api.fleetlize.fr/uploads/car-placeholderRed.png",
"inactive" => "https://api.fleetlize.fr/uploads/car-placeholderOrange.png"
],
"statusMessage" => "Retard de 15 minutes en raison de travaux",
"metadata" => [
"capacité" => "50 passagers",
"compagnie" => "RATP",
"immatriculation" => "AB-123-CD"
]
]
],
"webhook_config" => [
"webhookUrl" => "https://votre-site.com/webhook",
"events" => ["geofence_enter", "geofence_exit"],
"secret" => "mon-secret-key-123",
"geofences" => [
[
"lat" => 42.768139,
"lng" => 1.488861,
"radius" => 75,
"label" => "Entrée"
],
[
"lat" => 42.763846,
"lng" => 1.479987,
"radius" => 75,
"label" => "Sortie"
]
]
],
"auto_terminate" => [
"onArrival" => true,
"delayAfterArrival" => 900,
"proximityThreshold" => 25
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer VOTRE_CLE_API",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($statusCode === 201) {
$result = json_decode($response, true);
echo "Partage créé : " . $result['data']['url'];
} else {
echo "Erreur : " . $response;
}
curl_close($ch);
?>
JavaScript (Fetch API)
const data = {
tracker_imeis: ["863130065574643"],
duration: 86400,
refresh_rate: 10,
ip_whitelist: ["192.168.1.1", "10.0.0.1"],
map_config: {
theme: "light",
language: "fr",
hideCredits: false,
hideShareDetails: false,
hideControls: false,
centerOnTracker: true,
waypointMarkerUrl: "https://example.com/marker.png",
clustering: {
enabled: true,
maxZoomCluster: 15
},
uiOptions: {
refreshButton: true
},
allowedDomains: ["fleetlize.fr", "*.fleetlize.fr"]
},
route_config: {
waypoints: [
{ lat: 42.768139, lng: 1.488861, label: "Départ" },
{ lat: 42.766644, lng: 1.48284, label: "Étape" },
{ lat: 42.763846, lng: 1.479987, label: "Arrivée" }
],
showRoute: true,
showAllMarkers: false,
showEta: true,
routeColor: "#FF6B00",
profile: "driving-car",
avoidFeatures: ["highways", "tollways"],
preference: "fastest",
updateRoute: true,
manualEta: {
departureTime: "08:30",
arrivalTime: "14:45"
}
},
display_config: {
showSpeed: true,
showAddress: true,
showCoordinates: false,
showOrientation: true,
showLastUpdate: true
},
vehicle_info: {
"863130065574643": {
name: "Bus Ligne 12",
description: "Direction Gare de Lyon",
icons: {
active: "https://api.fleetlize.fr/uploads/car-placeholderGreen.png",
offline: "https://api.fleetlize.fr/uploads/car-placeholderRed.png",
inactive: "https://api.fleetlize.fr/uploads/car-placeholderOrange.png"
},
statusMessage: "Retard de 15 minutes en raison de travaux",
metadata: {
capacité: "50 passagers",
compagnie: "RATP",
immatriculation: "AB-123-CD"
}
}
},
webhook_config: {
webhookUrl: "https://votre-site.com/webhook",
events: ["geofence_enter", "geofence_exit"],
secret: "mon-secret-key-123",
geofences: [
{
lat: 42.768139,
lng: 1.488861,
radius: 75,
label: "Entrée"
},
{
lat: 42.763846,
lng: 1.479987,
radius: 75,
label: "Sortie"
}
]
},
auto_terminate: {
onArrival: true,
delayAfterArrival: 900,
proximityThreshold: 25
}
};
fetch('https://api.fleetlize.fr/api/v1/shares', {
method: 'POST',
headers: {
'Authorization': 'Bearer VOTRE_CLE_API',
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
if (response.status === 201) {
return response.json();
}
throw new Error('Erreur API');
})
.then(result => {
console.log('Partage créé:', result.data.url);
})
.catch(error => {
console.error('Erreur:', error);
});
Python (Requests)
import requests
url = "https://api.fleetlize.fr/api/v1/shares"
headers = {
"Authorization": "Bearer VOTRE_CLE_API",
"Content-Type": "application/json"
}
data = {
"tracker_imeis": ["863130065574643"],
"duration": 86400,
"refresh_rate": 10,
"ip_whitelist": ["192.168.1.1", "10.0.0.1"],
"map_config": {
"theme": "light",
"language": "fr",
"hideCredits": False,
"hideShareDetails": False,
"hideControls": False,
"centerOnTracker": True,
"waypointMarkerUrl": "https://example.com/marker.png",
"clustering": {
"enabled": True,
"maxZoomCluster": 15
},
"uiOptions": {
"refreshButton": True
},
"allowedDomains": ["fleetlize.fr", "*.fleetlize.fr"]
},
"route_config": {
"waypoints": [
{"lat": 42.768139, "lng": 1.488861, "label": "Départ"},
{"lat": 42.766644, "lng": 1.48284, "label": "Étape"},
{"lat": 42.763846, "lng": 1.479987, "label": "Arrivée"}
],
"showRoute": True,
"showAllMarkers": False,
"showEta": True,
"routeColor": "#FF6B00",
"profile": "driving-car",
"avoidFeatures": ["highways", "tollways"],
"preference": "fastest",
"updateRoute": True,
"manualEta": {
"departureTime": "08:30",
"arrivalTime": "14:45"
}
},
"display_config": {
"showSpeed": True,
"showAddress": True,
"showCoordinates": False,
"showOrientation": True,
"showLastUpdate": True
},
"vehicle_info": {
"863130065574643": {
"name": "Bus Ligne 12",
"description": "Direction Gare de Lyon",
"icons": {
"active": "https://api.fleetlize.fr/uploads/car-placeholderGreen.png",
"offline": "https://api.fleetlize.fr/uploads/car-placeholderRed.png",
"inactive": "https://api.fleetlize.fr/uploads/car-placeholderOrange.png"
},
"statusMessage": "Retard de 15 minutes en raison de travaux",
"metadata": {
"capacité": "50 passagers",
"compagnie": "RATP",
"immatriculation": "AB-123-CD"
}
}
},
"webhook_config": {
"webhookUrl": "https://votre-site.com/webhook",
"events": ["geofence_enter", "geofence_exit"],
"secret": "mon-secret-key-123",
"geofences": [
{
"lat": 42.768139,
"lng": 1.488861,
"radius": 75,
"label": "Entrée"
},
{
"lat": 42.763846,
"lng": 1.479987,
"radius": 75,
"label": "Sortie"
}
]
},
"auto_terminate": {
"onArrival": True,
"delayAfterArrival": 900,
"proximityThreshold": 25
}
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
result = response.json()
print(f"Partage créé : {result['data']['url']}")
else:
print(f"Erreur {response.status_code}: {response.text}")
Réponse exemple
201 Created
{
"success": true,
"message": "Partage créé avec succès",
"data": {
"share_id": 123,
"token": "abc123def456ghi789jkl012",
"url": "https://share.fleetlize.fr/share/map?token=abc123def456ghi789jkl012",
"expires_at": "2025-01-20T14:30:00.000Z",
"created_at": "2025-01-19T14:30:00.000Z",
"config": {
"tracker_ids": [1],
"refresh_rate": 10,
"map_config": {
"theme": "light",
"language": "fr",
"hideCredits": false,
"hideShareDetails": false,
"hideControls": false,
"centerOnTracker": true,
"waypointMarkerUrl": "https://example.com/marker.png",
"clustering": {
"enabled": true,
"maxZoomCluster": 15
},
"uiOptions": {
"refreshButton": true
},
"allowedDomains": ["fleetlize.fr", "*.fleetlize.fr"]
},
"route_config": {
"waypoints": [
{"lat": 42.768139, "lng": 1.488861, "label": "Départ"},
{"lat": 42.766644, "lng": 1.48284, "label": "Étape"},
{"lat": 42.763846, "lng": 1.479987, "label": "Arrivée"}
],
"showRoute": true,
"showAllMarkers": false,
"showEta": true,
"routeColor": "#FF6B00",
"profile": "driving-car",
"avoidFeatures": ["highways", "tollways"],
"preference": "fastest",
"updateRoute": true,
"manualEta": {
"departureTime": "08:30",
"arrivalTime": "14:45"
}
},
"display_config": {
"showSpeed": true,
"showAddress": true,
"showCoordinates": false,
"showOrientation": true,
"showLastUpdate": true
},
"vehicle_info": {
"863130065574643": {
"name": "Bus Ligne 12",
"description": "Direction Gare de Lyon",
"icons": {
"active": "https://api.fleetlize.fr/uploads/car-placeholderGreen.png",
"offline": "https://api.fleetlize.fr/uploads/car-placeholderRed.png",
"inactive": "https://api.fleetlize.fr/uploads/car-placeholderOrange.png"
},
"statusMessage": "Retard de 15 minutes en raison de travaux",
"metadata": {
"capacité": "50 passagers",
"compagnie": "RATP",
"immatriculation": "AB-123-CD"
}
}
}
}
}
}