Obtener línea de tiempo combinada de trips, stops y stops entre trips
curl --request GET \
--url https://api.ugps.io/api/trips/{flespiId}/timeline \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ugps.io/api/trips/{flespiId}/timeline"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ugps.io/api/trips/{flespiId}/timeline', 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.ugps.io/api/trips/{flespiId}/timeline",
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: Bearer <token>"
],
]);
$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.ugps.io/api/trips/{flespiId}/timeline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.ugps.io/api/trips/{flespiId}/timeline")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/trips/{flespiId}/timeline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "success",
"data": [
{
"eventType": "trip",
"begin": 123,
"end": 123,
"timestamp": 123,
"data": {
"id": 123,
"distance": 123,
"duration": 123,
"avg_speed": 123,
"max_speed": 123,
"start_battery_level": 123,
"end_battery_level": 123,
"startAddress": "<string>",
"endAddress": "<string>",
"address": "<string>",
"lat": 123,
"lng": 123,
"type": "<string>",
"positions": [
{
"lat": 123,
"lng": 123,
"alt": 123,
"dir": 123,
"speed": 123,
"timestamp": 123
}
],
"route": "<string>",
"clientId": "<string>",
"assetId": "<string>",
"trip_id": 123,
"active": true,
"device_id": 123,
"ident": "<string>",
"stop_duration": 123
},
"tripId": 12345
}
]
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "Recurso no encontrado"
}{
"message": "Error interno del servidor"
}Tracking - Viajes
Obtener línea de tiempo combinada de trips, stops y stops entre trips
Obtiene una línea de tiempo cronológica que combina trips, stops dentro de trips y stops entre trips de un dispositivo específico. Todos los eventos están ordenados cronológicamente por su timestamp de inicio (begin).
Tipos de eventos en la línea de tiempo:
trip: Viaje del dispositivostop_in_trip: Parada dentro de un viajestop_between_trips: Parada entre viajes
Formatos de fecha aceptados:
DD/MM/YYYY- Solo fecha (desde las 00:00:00 hasta las 23:59:59 del día)DD/MM/YYYY HH:mm- Fecha con hora y minutos específicosDD/MM/YYYY HH:mm:ss- Fecha con hora, minutos y segundos específicos
Ejemplos:
- Solo fecha:
01/01/2025→ Desde 01/01/2025 00:00:00 hasta 01/01/2025 23:59:59 - Con hora:
01/01/2025 08:30→ Desde 01/01/2025 08:30:00 - Con hora completa:
01/01/2025 08:30:45→ Desde 01/01/2025 08:30:45
GET
/
api
/
trips
/
{flespiId}
/
timeline
Obtener línea de tiempo combinada de trips, stops y stops entre trips
curl --request GET \
--url https://api.ugps.io/api/trips/{flespiId}/timeline \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ugps.io/api/trips/{flespiId}/timeline"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ugps.io/api/trips/{flespiId}/timeline', 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.ugps.io/api/trips/{flespiId}/timeline",
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: Bearer <token>"
],
]);
$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.ugps.io/api/trips/{flespiId}/timeline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.ugps.io/api/trips/{flespiId}/timeline")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/trips/{flespiId}/timeline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "success",
"data": [
{
"eventType": "trip",
"begin": 123,
"end": 123,
"timestamp": 123,
"data": {
"id": 123,
"distance": 123,
"duration": 123,
"avg_speed": 123,
"max_speed": 123,
"start_battery_level": 123,
"end_battery_level": 123,
"startAddress": "<string>",
"endAddress": "<string>",
"address": "<string>",
"lat": 123,
"lng": 123,
"type": "<string>",
"positions": [
{
"lat": 123,
"lng": 123,
"alt": 123,
"dir": 123,
"speed": 123,
"timestamp": 123
}
],
"route": "<string>",
"clientId": "<string>",
"assetId": "<string>",
"trip_id": 123,
"active": true,
"device_id": 123,
"ident": "<string>",
"stop_duration": 123
},
"tripId": 12345
}
]
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "Recurso no encontrado"
}{
"message": "Error interno del servidor"
}Authorizations
Token de sesión Better Auth o API token (atk_...) en el header Authorization: Bearer <token>. Los JWT legacy ya no son válidos.
Path Parameters
ID del dispositivo en Flespi
Query Parameters
Fecha de inicio. Formatos aceptados - DD/MM/YYYY, DD/MM/YYYY HH:mm, DD/MM/YYYY HH:mm:ss (ejemplo: 01/01/2025 o 01/01/2025 08:30)
Fecha de fin. Formatos aceptados - DD/MM/YYYY, DD/MM/YYYY HH:mm, DD/MM/YYYY HH:mm:ss (ejemplo: 31/01/2025 o 31/01/2025 17:45)