Listar comandos
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/commands \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/commands"
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}/commands', 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}/commands",
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}/commands"
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}/commands")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/commands")
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[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Apagar motor",
"widget": {
"type": "button",
"label": "Apagar",
"confirm": true,
"confirm_message": "¿Estás seguro de apagar el motor?"
}
},
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Encender motor",
"widget": {
"type": "button",
"label": "Encender",
"confirm": true
}
},
{
"id": "770e8400-e29b-41d4-a716-446655440000",
"name": "Configurar APN",
"widget": {
"type": "form",
"fields": [
{ "name": "apn", "type": "text", "label": "APN" },
{ "name": "user", "type": "text", "label": "Usuario" },
{ "name": "password", "type": "password", "label": "Contraseña" }
]
}
}
]
Comandos
Listar comandos
Lista los comandos disponibles para el modelo del dispositivo
GET
/
devices
/
{id}
/
commands
Listar comandos
curl --request GET \
--url https://api.locatebyteli.com/devices/{id}/commands \
--header 'Authorization: <authorization>'import requests
url = "https://api.locatebyteli.com/devices/{id}/commands"
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}/commands', 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}/commands",
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}/commands"
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}/commands")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.locatebyteli.com/devices/{id}/commands")
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[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Apagar motor",
"widget": {
"type": "button",
"label": "Apagar",
"confirm": true,
"confirm_message": "¿Estás seguro de apagar el motor?"
}
},
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Encender motor",
"widget": {
"type": "button",
"label": "Encender",
"confirm": true
}
},
{
"id": "770e8400-e29b-41d4-a716-446655440000",
"name": "Configurar APN",
"widget": {
"type": "form",
"fields": [
{ "name": "apn", "type": "text", "label": "APN" },
{ "name": "user", "type": "text", "label": "Usuario" },
{ "name": "password", "type": "password", "label": "Contraseña" }
]
}
}
]
Authorization
API Key. Formato:
Bearer lbt_•••Path Parameters
ID del dispositivo
Respuesta
Array de comandos disponibles:ID del comando
Nombre legible del comando
Configuración del widget UI para el comando
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Apagar motor",
"widget": {
"type": "button",
"label": "Apagar",
"confirm": true,
"confirm_message": "¿Estás seguro de apagar el motor?"
}
},
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Encender motor",
"widget": {
"type": "button",
"label": "Encender",
"confirm": true
}
},
{
"id": "770e8400-e29b-41d4-a716-446655440000",
"name": "Configurar APN",
"widget": {
"type": "form",
"fields": [
{ "name": "apn", "type": "text", "label": "APN" },
{ "name": "user", "type": "text", "label": "Usuario" },
{ "name": "password", "type": "password", "label": "Contraseña" }
]
}
}
]
⌘I