Documentation API v1.0
API de partage de position GPS en temps réel
Récupérer un partage
Obtenir les détails d'un partage spécifique
GET
/api/v1/shares/{share_id}
Description
Récupère les informations détaillées d'un partage existant via son identifiant unique.
Paramètres URL
share_id (string, requis) - L'identifiant unique du partage
Exemples de code
PHP
<?php
$shareId = 123;
$url = "https://api.fleetlize.fr/api/v1/shares/" . $shareId;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
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 === 200) {
$data = json_decode($response, true);
print_r($data);
} else {
echo "Erreur : " . $response;
}
curl_close($ch);
?>
JavaScript (Fetch API)
const shareId = 123;
fetch(`https://api.fleetlize.fr/api/v1/shares/${shareId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer VOTRE_CLE_API',
'Content-Type': 'application/json'
}
})
.then(response => {
if (response.ok) {
return response.json();
}
throw new Error('Erreur API');
})
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Erreur:', error);
});
Python (Requests)
import requests
share_id = 123
url = f"https://api.fleetlize.fr/api/v1/shares/{share_id}"
headers = {
"Authorization": "Bearer VOTRE_CLE_API",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
print(data)
else:
print(f"Erreur {response.status_code}: {response.text}")
Réponse exemple
200 OK
{
"success": true,
"data": {
"share_id": 123,
"token": "abc123def456ghi789jkl012",
"url": "https://share.fleetlize.fr/share/map?token=abc123def456ghi789jkl012",
"expires_at": "2025-01-20T14:30:00.000Z",
"is_active": true,
"total_views": 42,
"last_accessed_at": "2025-01-19T16:45:00.000Z",
"created_at": "2025-01-19T14:30:00.000Z",
"config": {
"tracker_ids": [1],
"refresh_rate": 10,
"map_config": {
"theme": "light",
"language": "fr",
"centerOnTracker": true
},
"route_config": {
"waypoints": [
{"lat": 42.768139, "lng": 1.488861, "label": "Départ"},
{"lat": 42.763846, "lng": 1.479987, "label": "Arrivée"}
],
"showRoute": true,
"showEta": true
},
"display_config": {
"showSpeed": true,
"showAddress": true,
"showLastUpdate": true
},
"vehicle_info": {}
}
}
}