curl --request PUT \
--url https://api.ugps.io/api/alerts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"speedLimit": 123,
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"state": true,
"description": "<string>",
"minDuration": 123
}
'import requests
url = "https://api.ugps.io/api/alerts/{id}"
payload = {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": ["<string>"],
"users": ["<string>"],
"speedLimit": 123,
"emails": ["jsmith@example.com"],
"phones": ["<string>"],
"state": True,
"description": "<string>",
"minDuration": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alertTriggerId: '<string>',
name: '<string>',
assets: ['<string>'],
users: ['<string>'],
speedLimit: 123,
emails: ['jsmith@example.com'],
phones: ['<string>'],
state: true,
description: '<string>',
minDuration: 123
})
};
fetch('https://api.ugps.io/api/alerts/{id}', 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/alerts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alertTriggerId' => '<string>',
'name' => '<string>',
'assets' => [
'<string>'
],
'users' => [
'<string>'
],
'speedLimit' => 123,
'emails' => [
'jsmith@example.com'
],
'phones' => [
'<string>'
],
'state' => true,
'description' => '<string>',
'minDuration' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/alerts/{id}"
payload := strings.NewReader("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.ugps.io/api/alerts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/alerts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"clientId": "<string>",
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"typeNotification": {
"email": true,
"whatsapp": true,
"app": true,
"browser": true
},
"state": true,
"description": "<string>",
"speedLimit": 123,
"minDuration": 123,
"geofences": [
"<string>"
],
"geofenceActivationType": "entrance",
"calculatorId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "Recurso no encontrado"
}{
"message": "Error interno del servidor"
}Actualizar una alerta por ID
Actualiza una alerta existente. El payload se valida según el tipo de trigger (alertTriggerId en el body o el de la alerta actual). Mismas reglas que creación: speed_limit requiere speedLimit; geofence requiere geofences y geofenceActivationType; ignition y lost_connection solo base. Si se modifican speedLimit, geofences o minDuration, el sistema actualiza el calculator en Flespi.
curl --request PUT \
--url https://api.ugps.io/api/alerts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"speedLimit": 123,
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"state": true,
"description": "<string>",
"minDuration": 123
}
'import requests
url = "https://api.ugps.io/api/alerts/{id}"
payload = {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": ["<string>"],
"users": ["<string>"],
"speedLimit": 123,
"emails": ["jsmith@example.com"],
"phones": ["<string>"],
"state": True,
"description": "<string>",
"minDuration": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alertTriggerId: '<string>',
name: '<string>',
assets: ['<string>'],
users: ['<string>'],
speedLimit: 123,
emails: ['jsmith@example.com'],
phones: ['<string>'],
state: true,
description: '<string>',
minDuration: 123
})
};
fetch('https://api.ugps.io/api/alerts/{id}', 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/alerts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alertTriggerId' => '<string>',
'name' => '<string>',
'assets' => [
'<string>'
],
'users' => [
'<string>'
],
'speedLimit' => 123,
'emails' => [
'jsmith@example.com'
],
'phones' => [
'<string>'
],
'state' => true,
'description' => '<string>',
'minDuration' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/alerts/{id}"
payload := strings.NewReader("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.ugps.io/api/alerts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/alerts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"clientId": "<string>",
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"typeNotification": {
"email": true,
"whatsapp": true,
"app": true,
"browser": true
},
"state": true,
"description": "<string>",
"speedLimit": 123,
"minDuration": 123,
"geofences": [
"<string>"
],
"geofenceActivationType": "entrance",
"calculatorId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"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 recurso
Body
- Option 1
- Option 2
- Option 3
- Option 4
Payload de creación/edición de alerta según tipo (discriminado por alertTriggerId). La validación exige los campos del tipo correspondiente.
ID del disparador de alerta (determina el tipo y los campos requeridos)
Nombre de la alerta
IDs de activos asociados
IDs de usuarios. Si typeNotification.app o typeNotification.browser son true, es obligatorio y debe tener al menos un elemento.
Límite de velocidad en km/h. Obligatorio para tipo exceso de velocidad. Crea calculator en Flespi automáticamente.
Emails para notificaciones. Si typeNotification.email es true, es obligatorio y debe tener al menos un elemento.
Teléfonos para notificaciones (whatsapp). Si typeNotification.whatsapp es true, es obligatorio y debe tener al menos un elemento.
Canales de notificación. Si un canal está en true, el array asociado no puede estar vacío:
- email true requiere al menos un email en
emails - whatsapp true requiere al menos un teléfono en
phones - app o browser true requieren al menos un usuario en
users
Show child attributes
Show child attributes
Estado de la alerta (true activa, false inactiva)
Descripción opcional
Duración mínima en segundos. Por defecto 30 para exceso de velocidad.