Historial de ruta
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/history/route \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/history/route"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.locatebyteli.com/devices/{id}/history/route', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.locatebyteli.com/devices/{id}/history/route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.locatebyteli.com/devices/{id}/history/route"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.locatebyteli.com/devices/{id}/history/route")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/history/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"points": [
{
"latitude": 19.4326,
"longitude": -99.1332,
"speed": 45,
"timestamp": 1710756000
},
{
"latitude": 19.4330,
"longitude": -99.1340,
"speed": 50,
"timestamp": 1710756060
}
],
"stops": [
{
"latitude": 19.4350,
"longitude": -99.1360,
"duration": 1800,
"start": 1710757000,
"end": 1710758800
}
],
"total_distance": 15.5,
"total_duration": 3600
}
Historial
Historial de ruta
Obtiene la ruta recorrida por el dispositivo en un rango de tiempo
GET
/
devices
/
{id}
/
history
/
route
Historial de ruta
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/history/route \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/history/route"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.locatebyteli.com/devices/{id}/history/route', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.locatebyteli.com/devices/{id}/history/route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.locatebyteli.com/devices/{id}/history/route"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.locatebyteli.com/devices/{id}/history/route")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/history/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"points": [
{
"latitude": 19.4326,
"longitude": -99.1332,
"speed": 45,
"timestamp": 1710756000
},
{
"latitude": 19.4330,
"longitude": -99.1340,
"speed": 50,
"timestamp": 1710756060
}
],
"stops": [
{
"latitude": 19.4350,
"longitude": -99.1360,
"duration": 1800,
"start": 1710757000,
"end": 1710758800
}
],
"total_distance": 15.5,
"total_duration": 3600
}
Authorization
API Key. Formato:
Bearer lbt_•••Path Parameters
ID del dispositivo
Query Parameters
Timestamp Unix de inicio
Timestamp Unix de fin
Duración mínima de parada (segundos)
También disponible en
GET /devices/{id}/routeRespuesta
Puntos de ruta, paradas y resumen del recorrido.{
"points": [
{
"latitude": 19.4326,
"longitude": -99.1332,
"speed": 45,
"timestamp": 1710756000
},
{
"latitude": 19.4330,
"longitude": -99.1340,
"speed": 50,
"timestamp": 1710756060
}
],
"stops": [
{
"latitude": 19.4350,
"longitude": -99.1360,
"duration": 1800,
"start": 1710757000,
"end": 1710758800
}
],
"total_distance": 15.5,
"total_duration": 3600
}
Errores
| Código | Descripción |
|---|---|
400 | Parámetros inválidos |
404 | Dispositivo no encontrado |
500 | Error interno del servidor |
⌘I