Historial de eventos
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/history/events \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/history/events"
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/events', 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/events",
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/events"
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/events")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/history/events")
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[
{
"alarm_code": "SOS",
"context": { "triggered_by": "button" },
"speed": 60,
"satellite": 8,
"coordinates": [19.4326, -99.1332],
"mcc": 334,
"mnc": 20,
"dbm": -75,
"timestamp": 1710756000
},
{
"alarm_code": "OVERSPEED",
"context": { "limit": 80, "actual": 120 },
"speed": 120,
"satellite": 10,
"coordinates": [19.4400, -99.1400],
"mcc": 334,
"mnc": 20,
"dbm": -68,
"timestamp": 1710757500
}
]
Historial
Historial de eventos
Obtiene los eventos/alarmas del dispositivo en un rango de tiempo
GET
/
devices
/
{id}
/
history
/
events
Historial de eventos
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/history/events \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/history/events"
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/events', 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/events",
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/events"
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/events")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/history/events")
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[
{
"alarm_code": "SOS",
"context": { "triggered_by": "button" },
"speed": 60,
"satellite": 8,
"coordinates": [19.4326, -99.1332],
"mcc": 334,
"mnc": 20,
"dbm": -75,
"timestamp": 1710756000
},
{
"alarm_code": "OVERSPEED",
"context": { "limit": 80, "actual": 120 },
"speed": 120,
"satellite": 10,
"coordinates": [19.4400, -99.1400],
"mcc": 334,
"mnc": 20,
"dbm": -68,
"timestamp": 1710757500
}
]
Authorization
API Key. Formato:
Bearer lbt_•••Path Parameters
ID del dispositivo
Query Parameters
Timestamp Unix de inicio
Timestamp Unix de fin
También disponible en
GET /devices/{id}/eventsRespuesta
Array de eventos con la siguiente estructura:Código de la alarma o evento
Datos adicionales del evento
Velocidad al momento del evento (km/h)
Satélites GPS captados
[latitud, longitud]Mobile Country Code
Mobile Network Code
Intensidad de señal celular
Timestamp Unix del evento
[
{
"alarm_code": "SOS",
"context": { "triggered_by": "button" },
"speed": 60,
"satellite": 8,
"coordinates": [19.4326, -99.1332],
"mcc": 334,
"mnc": 20,
"dbm": -75,
"timestamp": 1710756000
},
{
"alarm_code": "OVERSPEED",
"context": { "limit": 80, "actual": 120 },
"speed": 120,
"satellite": 10,
"coordinates": [19.4400, -99.1400],
"mcc": 334,
"mnc": 20,
"dbm": -68,
"timestamp": 1710757500
}
]
Errores
| Código | Descripción |
|---|---|
404 | Dispositivo no encontrado |
500 | Error en la consulta |
⌘I