Historial de viajes
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/history/travels \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/history/travels"
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/travels', 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/travels",
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/travels"
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/travels")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/history/travels")
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{
"travels": [
{
"start": {
"latitude": 19.4326,
"longitude": -99.1332,
"timestamp": 1710750000,
"address": "Av. Insurgentes Sur 1234, CDMX"
},
"end": {
"latitude": 19.4500,
"longitude": -99.1500,
"timestamp": 1710753600,
"address": "Av. Reforma 567, CDMX"
},
"distance": 8.5,
"duration": 3600,
"max_speed": 85,
"avg_speed": 42
},
{
"start": {
"latitude": 19.4500,
"longitude": -99.1500,
"timestamp": 1710757200,
"address": "Av. Reforma 567, CDMX"
},
"end": {
"latitude": 19.4326,
"longitude": -99.1332,
"timestamp": 1710760800,
"address": "Av. Insurgentes Sur 1234, CDMX"
},
"distance": 9.2,
"duration": 3600,
"max_speed": 90,
"avg_speed": 46
}
],
"total_travels": 2,
"total_distance": 17.7,
"total_duration": 7200
}
Historial
Historial de viajes
Obtiene los viajes del dispositivo en un rango de tiempo
GET
/
devices
/
{id}
/
history
/
travels
Historial de viajes
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/history/travels \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/history/travels"
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/travels', 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/travels",
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/travels"
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/travels")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/history/travels")
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{
"travels": [
{
"start": {
"latitude": 19.4326,
"longitude": -99.1332,
"timestamp": 1710750000,
"address": "Av. Insurgentes Sur 1234, CDMX"
},
"end": {
"latitude": 19.4500,
"longitude": -99.1500,
"timestamp": 1710753600,
"address": "Av. Reforma 567, CDMX"
},
"distance": 8.5,
"duration": 3600,
"max_speed": 85,
"avg_speed": 42
},
{
"start": {
"latitude": 19.4500,
"longitude": -99.1500,
"timestamp": 1710757200,
"address": "Av. Reforma 567, CDMX"
},
"end": {
"latitude": 19.4326,
"longitude": -99.1332,
"timestamp": 1710760800,
"address": "Av. Insurgentes Sur 1234, CDMX"
},
"distance": 9.2,
"duration": 3600,
"max_speed": 90,
"avg_speed": 46
}
],
"total_travels": 2,
"total_distance": 17.7,
"total_duration": 7200
}
Authorization
API Key. Formato:
Bearer lbt_•••Path Parameters
ID del dispositivo
Query Parameters
Timestamp Unix de inicio
Timestamp Unix de fin
Descripción
Obtiene segmentos de movimiento con inicio, fin, distancia y duración.Respuesta
Segmentos de viaje con inicio, fin, distancia y duración.{
"travels": [
{
"start": {
"latitude": 19.4326,
"longitude": -99.1332,
"timestamp": 1710750000,
"address": "Av. Insurgentes Sur 1234, CDMX"
},
"end": {
"latitude": 19.4500,
"longitude": -99.1500,
"timestamp": 1710753600,
"address": "Av. Reforma 567, CDMX"
},
"distance": 8.5,
"duration": 3600,
"max_speed": 85,
"avg_speed": 42
},
{
"start": {
"latitude": 19.4500,
"longitude": -99.1500,
"timestamp": 1710757200,
"address": "Av. Reforma 567, CDMX"
},
"end": {
"latitude": 19.4326,
"longitude": -99.1332,
"timestamp": 1710760800,
"address": "Av. Insurgentes Sur 1234, CDMX"
},
"distance": 9.2,
"duration": 3600,
"max_speed": 90,
"avg_speed": 46
}
],
"total_travels": 2,
"total_distance": 17.7,
"total_duration": 7200
}
Errores
| Código | Descripción |
|---|---|
404 | Dispositivo no encontrado |
500 | Error interno del servidor |
⌘I